Q: If a person doubts in his prayer, he should act upon that which he is certain of, or upon what is weightier in his mind, and do Sajdah Sahw at the end. But what if it becomes clear to him (lateron during the prayer) that the course of action he has proceeded upon is in accordance with reality and that he has neither added to or deleted anything from his prayer. Should he still do Sajdah Sahw or not anymore?
I read that Shaykh Uythamin said: "... he no longer has to perform the prostration for forgetfulness, due to the fact that doubt which necessitates it is no longer present.
A different saying is that it is still necessary to perform the prostration of forgetfulness in order to humiliate the Shaytan, due to the saying of the Prophet (peace be upon him), "And if he has prayed it completely then the two prostrations will be a humiliation for the Shaytan."
And due to the fact that he performed a part of his prayer in a state of doubt with regards to its performance and this is the more correct saying insha'Allah.
An example of this is if a person prays and doubts in a rak'ah, whether it is the second or third rak'ah. Neither of these two possibilities carries more weight in his mind, so he makes it the second rak'ah and completes his prayer upon that basis. But whilst continuing, it becomes clear to him, that it was the second rak'ah in reality. In such a case there is no prostration for for forgetfulness due upon him in the saying most well known in the madhhab, but prostration for forgetfulness before the salutation is required from him and the second saying that we hold to be preferable."
What if such cases do happen often? Like when one does stand up for the 3th rakaat one does doubt and does think he missed the first tashahhud then in the 4th rakaat he remembrs he did the first tashahhud.