If a person forgets Tashahhud...
If a person forgets Tashahhud, and rises and remembers before Ruku, he should sit down to recite it, and then stand up again. He will then continue with his prayer. But if he remembers this in Ruku or thereafter, he should complete the prayer and perform two Sajdah-us-Sahv for the forgotten Tashahhid. It is Mustahab to say before Tashahhud: Al-hamdu li-llah ; Bismi-llahi wa bi-llah, wal-hamdu li-llah, wa Khayr-ul-asma'i li-llah.
It is also Mustahab to place one's hands on noe's thights, with joined fingers, and to look at one's laps, and to say this after Tashahhud and Salawat: Wa taqabbal shafa atahu wa-rfa darajatah. Salam in the Prayers While a person is sitting, after reciting Tashahhud in the last unit (Rak'ah), and his body is tranquil, it is Mustahab to say: As-salamu alayka ayyuhan-nabiyyu wa rahmatu-llahi wa barakatuh.
Then it is obligatory to say: As-salamu alaykum ; and as a recommended precaution add to it, Wa rahmatu-llahi wa barakatuh. Alternatively, he can say: As-salamu alayna wa ala ibadi-llahis-salihin. But if he recites this Salam, then as per obligatory precaution, he must follow it up with saying: As-salamu alaykum.
Tartib (Sequence) If a person forgets a Rukn (elemental part) of the prayer, an performs the next Rukn, like before performing Ruku if he performs the two Sajdahs, his prayer would become void, as as measure of precaution. If a person forgets a Rukn, and performs an act after it which is not a Rukn, like if he recites Tashahhud without performing the two Sajdahs, he should perform the Rukn and should recite again the part which he performed erroneously earlier than the Rukn.
If a person forgets a thing which is not a Rukn, and performs a Rukn which comes after it, like if he forgets al-Hamd and begins performing Ruku, his prayer is in order. If a person forgets an act which is not a Rukn, and performs the next act which too, is not a Rukn, like if he forgets al-Hamd and recites the other Surah, he should perform what he has forgotten, and then recite again the thing which he mistakenly recited earlier.
Muwalat (Maintenance of Succession) A person should maintain continuity during prayer, that is he should perform various acts of prayer, like Ruku, two Sajdahs and Tashahhud, in continuous succession, and he should recite the Dhikr etc. also in usual succession. If he allows an undue interval between different acts, till it becomes difficult to visualise that he is praying, his prayer will be void.