Wa `alaykum as-salamu wa rahmatullahi wa barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
You are not alone. Many people are facing the same problem. It is normal that we forget offer an essential part of the prayer.
The reasons behind this state of forgetfulness vary, but most of the reasons have to do with not being focusing on the actions of the prayer. We have to bear in mind that Satan is plotting to spoil our prayer. He is taking all measures to distract us from praying in order to misguide us and deprive us of the rewards of prayer. This is Satan’s ultimate aim. Therefore, the solution to this state of forgetfulness is to focus and pay attention to every movement during the prayer.
Mindfulness Before, During, and After the Prayer
Before the Prayer, set your agenda according to the times of the prayers.
When making wudu, be thoughtful about the movements.
Don’t offer the prayer hastily. Give all the actions of the prayer their due time.
Try to get rid of the things that might distract you. Choose a remote room in the house which is far away from the noise of the street.
If there is a mosque close to your house, try to attend the congregational prayer if that is possible for you.
Praying in the mosque will help you get in touch with the community and you learn from peoples’ experiences.
Choose a clean area and put on good clothing.
We have to remember that we are standing before Allah the Almighty.
Stand upright and think of the prayer you are offering as your last prayer.
While reading the Quran, we have to ponder on every word we utter.
If you feel that you are distracted, say “A`udhu billahi min al-shaytan al-rajeem” (I seek refuge with Allah from the cursed Satan).
When you are done with the prayer after saying the tasleem, sit for a while and say the dhikr reported from the Prophet.
This dhikr makes up for the moments you felt distracted during the prayer.
Finally, make a lot of du`aa’ (supplications) to Allah to accept your prayer.
What To Do If You Made a Mistake in the Prayer
Now, we come to the main issue of how to handle the state of forgetfulness during the prayer. If you experience this state of doubt after finishing the prayer, you should disregard such doubt.
For example, if you finish the dhuhr prayer and you ask yourself how many rak`ahs you prayed, this doubt should be disregarded unless you are sure that you prayed three rak`ahs instead of four.
In this case, you have to offer one more rak`ah and offer two prostrations of forgetfulness (sahw).
If you experience this state of doubt during the prayer, you should act according to your best assumption and offer the two prostrations of forgetfulness after the tasleem.
The Messenger of Allah (peace be upon him) prayed and did more or less (rak`ahs). When he had said the tasleem, it was said: ‘O Messenger of Allah, has there been some change concerning the prayer?’ He said:
‘If there had been some change concerning the prayer, I would have told you. Rather I am a human being and I forget as you forget. If any one of you is not sure about his prayer, let him consider an estimate of what is correct, and complete his prayer on that basis, then say the tasleem and prostrate twice.” (An-Nasa’i)
In another narration, it is reported that the Prophet (peace be upon him) turned and prostrated twice.” (Ibn Majah)
How to Offer Sujud as-Sahw
As for how to perform the two prostrations of forgetfulness, they are like the prostration that you offer in prayer.
If the place of sahw is before taslim, you just say “Allahu akbar” and prostrate and say “subhana rabbiya al-`ala” three times.
Then you say “Allahu akbar” and sit, as normal.
Then you say “Allahu akbar” and prostrate and say “subhana rabbiya al-a`la.”
Then you sit and offer the tasleem as you normally would.
I hope this answers your question.