SectionSecond: Sujud as-Sahw Due to Omission
Not every omission in prayer is the same. One must distinguish between a pillar, an obligation, and a sunnah.
If He Leaves a Pillar of the Prayer
A pillar includes the opening takbir, bowing, prostration, tranquility, reciting al-Fatihah for the one required to recite it, the final tashahhud, and sitting for it.
Sujud as-sahw alone does not repair a missed pillar. Whoever forgets a bowing or a prostration must perform the pillar and what follows it according to the details known among the jurists, then perform sujud as-sahw.
If he remembers the pillar before reaching its place in the next rakah, he returns to it and performs it and what comes after it. If he reaches the same pillar in the next rakah before remembering, the next rakah takes the place of the deficient rakah according to a group of scholars, then he completes his prayer.
In these two cases related to making up bowing or prostration, sujud as-sahw is after salam according to this preferred view. As for the opening takbir, the prayer does not begin without it in the first place, and sujud as-sahw does not repair it.
These cases may differ depending on the pillar and the time of remembering. Whoever is confused about his situation, especially after salam or after a long interval, should ask a trustworthy scholar and should not suffice with two prostrations of forgetfulness while a pillar was left.
If He Leaves an Obligation from the Obligations of Prayer
Examples include forgetting the first tashahhud, or leaving the tasbih of bowing or prostration by forgetfulness according to those who view it as obligatory. If he has passed the place of that obligation, he completes his prayer and performs sujud as-sahw before salam.
Abdullah ibn Malik ibn Buhaynah, may Allah be pleased with him, narrated:
"The Prophet, peace and blessings be upon him, prayed Dhuhr with them. He stood after the first two rakahs and did not sit, so the people stood with him. When he completed the prayer and the people awaited his salam, he said takbir while sitting, prostrated twice before giving salam, then gave salam."
Agreed upon.
What Should Someone Do If He Forgot the First Tashahhud?
If he remembers before fully standing upright, he returns, sits, recites the tashahhud, then completes his prayer and performs sujud as-sahw. But if he has fully stood upright, he does not return to the tashahhud. Rather, he completes his prayer and prostrates twice before salam.
The Prophet, peace and blessings be upon him, said:
"If the imam stands after the first two rakahs, then if he remembers before standing upright, let him sit. If he has stood upright, then he should not sit, and he should perform the two prostrations of forgetfulness."
Narrated by Abu Dawud and Ibn Majah, and authenticated by al-Albani.
If He Leaves a Sunnah from the Sunnahs of Prayer
Whoever leaves a sunnah, such as reciting a surah after al-Fatihah, his prayer is not invalid, and sujud as-sahw is not obligatory upon him. Some scholars allowed prostration when some sunnahs are left by forgetfulness, but it is not obligatory, and the worshipper should not prostrate for every sunnah he misses so he does not open the door of waswasah upon himself.