The final tashahhud and sitting for it are two of the essential parts of the prayer without which it is not valid.
It says in Zaad al-Mustaqni’, listing the essential parts of the prayer: … and the final tashahhud and sitting for it.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said in al-Sharh: The words “the final tashahhud” refer to the 10th pillar or essential part of the prayer.
The evidence for that is the hadeeth of ‘Abd-Allaah ibn Mas’ood (may Allaah be pleased with him) who said: Before the tashahhud was made obligatory upon us, we used to say: Peace be upon Allaah from His slaves, peace be upon Jibreel and Mika’eel, peace be upon So and so and So and so. [Narrated by al-Daaraqutni with a saheeh isnaad]. The relevant point in this hadeeth is the phrase “before the tashahhud was made obligatory upon us.”
If someone were to try to refute what we say on the basis of analogy with the first tashahhud, because it is tashahhud, yet despite that the Prophet (blessings and peace of Allaah be upon him) forgot it and made up for it by doing the prostration of forgetfulness (sujood al-sahw), and this is the ruling with regard to obligatory actions of prayer, so why isn't the final tashahhud like this?
The answer to that is: No, because the basic principle is that both tashahhuds are obligatory, and but the first tashahhud is no longer in the same category because of the actions of the Messenger of Allaah (blessings and peace of Allaah be upon him), as he made up for it when he forgot it by doing the prostration of forgetfulness. Hence the final tashahhud remains obligatory and an essential part of the prayer.
And his saying “the sitting for it [the final tashahhud]” is the 11th pillar or essential part of the prayer; i.e., the sitting for the final tashahhud is an essential part of the prayer. So if we assume that a person stood up following the prostration and recited the tashahhud standing, that is not acceptable, because he has omitted an essential part, which is the sitting. It is essential to sit, and the tashahhud must also be recited whilst sitting, because he said “ the sitting for it”, so the sitting is connected to the tashahhud, and it may be understood from this that the tashahhud must be recited in the same sitting. End quote from al-Sharh al-Mumti’, 3/309
The basic principle with regard to the one who forgets one of the pillars or essential parts of the prayer is that he has to do it, otherwise his prayer is not valid. Shaykh Ibn ‘Uthaymeen (may Allaah have mercy upon him) said: The essential parts are obligatory and are among the most emphasised of obligations, with the difference that the pillars or essential parts are not waived in the case of forgetfulness, whereas the obligatory parts are waived in that case and can be made up for by doing the prostration of forgetfulness, unlike the essential parts. Hence if a person forgets an essential part, his prayer is not valid without it.
And he said: The evidence that the essential parts cannot be made up for with the prostration of forgetfulness is that when the Prophet (blessings and peace of Allaah be upon him) forgot two rak’ahs of Zuhr or ‘Asr prayer, he completed it and did what he had omitted and did the prostration of forgetfulness. This indicates that the essential parts are not waived in the case of forgetfulness, and it is essential to do them. End quote from al-Sharh al-Mumti’, 3/315, 323.
Based on that, if a person forgets the final tashahhud and says the salaam, if not much time has passed he should go and sit down again and say the tashahhud and then say the salaam, then he should do the prostration of forgetfulness and then say the salaam again. But if a long time has passed, he should repeat the prayer.
And Allaah knows best.