Accordingly, in the chapter of forgetfulness the worshipper must build on what he is certain of, disregard whatever remains doubtful, and perform two prostrations of forgetfulness in order to confound Satan. This is the ruling adopted by the majority of jurists.
There is, however, another report from Imam Aḥmad: one should proceed on the basis of what seems more probable. Shaykh Taqī al-Dīn wrote in al-Ikhtiyārāt: “If a person is unsure how many rakʿahs he has prayed, he should follow his predominant impression. This is a narration from Aḥmad, and it is also the view of ʿAlī ibn Abī Ṭālib and Ibn Masʿūd. The same rule governs most matters of the Sharīʿah; it is applied as well to circumambulation (ṭawāf), the saʿy between Ṣafā and Marwah, stoning the pillars, and so forth.”
Shaykh ʿAbd al-Raḥmān al-Saʿdī said: “The soundest opinion when a worshipper doubts the number of rakʿahs is that he builds on certainty—namely the lesser number—if the doubt is evenly balanced or if the lesser number is more convincing; but he follows his predominant impression when one possibility clearly outweighs the other.”
The authentic hadiths should be understood in this light: the ḥadīth of Abū Saʿīd directs one to revert to the lesser number in the presence of real doubt, while the ḥadīth of Ibn Masʿūd directs him to act according to his probable judgment. This latter point is explicit in his words: “let him strive to hit upon what is correct.”