As'salamu aaleikom
also sheikh Assim l Hakeem was asked:
Question:
what shud i do if i miss the first tashahhud and if i feel like i added one more rakat or less raka?
Anser:
1- If you missed the 1st tasha’hud our of forgetfulness, you should offer two prostration of forgetfulness before giving the salam.
2- If you thought that you have added a rak’ah while praying as in the case if you were standing and you remembered that this is the 5th Rak’sh, you should immediately sit down and offer the tashahud and then offer salam and then offer two prostrations and then offer salam again. In the case where you think that you have missed a rak’ah, you should pray that Rak’ah and then do the same as the above.
Wa 'alaykkumus salaam wa rahmatullaah, if the questioner knows for a fact that he added a rakaat or missed one(he must make up for the missed rakaat), then it is from the sunnah to do as the shaykh said. But a question arises which is very common... What if this person was in doubt as to whether he missed a rakaat or added. In this case, Shaykh 'Uthaymeen rahimahullaah says that there are three scenarios:
1) That he gets these kind of doubts all the time or it maybe that the person gets these doubts after the act of worship. In this case the shaykh rahimahullaah says that this is from waswaas and one should ignore these kind of waswaas and pay no attention to it. But if a person knows for certain after the salaah (or during the salaah_ that he had prayed less rakaat, then (if a short amount of time has passed), he should complete the prayer and do the tasleem, then prostration of forgetfullness, then tasleem. But if a long time has passed and the person remembers with certainty then he must repeat that prayer again.
2)That the person has a doubt, yet his heart is slightly inclined to either of the two (i.e if a person is praying Dhuhr and he gets a doubt as to whether he is in the 3rd rakaat or the 4th rakaat, but his heart is like 51% more inclined towards 3rd rakaat), then he acts upon what is weighty in his heart and complete his salaah based on that. At the end, he does the tasleem, prostration of forgetfullness, then tasleem.
3) That the person has a doubt and in his heart neither of the two is weighty (i.e a person is praying dhuhr and he gets a doubt as to whether he is in the 2nd rakaat or 3rd rakaat, and his heart is equally in doubt about both the scenarios) then in this case he acts upon that which is certain (i.e go for the lower number, which in this case is 2 rakaat) and complete his salaah based on that. At the end, he does the prostration of forgetfullness and then tasleem.
And Allaah knows best