Firstly: Doubting the Number of Units Prayed
Scholars are of two positions regarding one who doubts the number of units prayed, such as being unsure whether one has prayed three or four units in a four-unit prayer:
The first position: If one doubts whether one has prayed three or four units in a four-unit prayer, one prays an additional unit and prostrates due to forgetfulness. One does not act according to what is most likely. This is the position of the majority: Malikis, Shafi`is, and Hanbalis.
The second position: If one doubts whether one has prayed three or four units in a four-unit prayer, one attempts to determine which is more likely. If one possibility is more likely, he acts accordingly. Otherwise, he acts according to certainty, which is the lesser of the two. This is the position of the Hanafi school  Hanafis limit this to one who has a lot of doubts. and was chosen by al-Shawkani and Ibn `Uthaymin. Secondly: Doubts after Salams
Having doubts after performing the salams does not affect the prayer. This is the position of the majority: Hanafis, Shafi`is (according to the widely accepted view), Hanbalis, and one position among Malikis.