Madd (pronounced like “mud”), literally means “extension”. In recitation of the Qur’an (tajweed), madd is when you extend and stretch a vowel sound (aah, ooh, etc.).
There are two types of madd: fard (obligatory: you have to recite it) and mustahab (recommended: you should recite it). The general rule is that a madd inside a word is fard, while a madd that connects two words is mustahab.
For example, in Surah Baqarah, Allah says:
Translation: Reveal the names if you are true. [Surah Baqarah, verse 31]
the word [هَؤُلاء] contains two madh in the middle of the word (they are part of the word)–so you should always extend them in your recitation.
Meanwhile, in another verse of Surah Baqarah, Allah says:
Translation: Those who believe in what was revealed to them and what was revealed before them and in the Akhira they have certainty. [Surah Baqarah, verse 4]**
Here, we see a madd that connects two words, [مَا] and [أُنْزِلَ], so it is recommended to extend the alif sound.
Also, madd most commonly occurs when you have an alif, waw, or ya, followed by a hamza–these vowels recieve madd.
Wallahu ta’ala ‘alim.