Praise be to Allah.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: The scholars said that no attention is to be paid to uncertainty in three cases. The first is when it is merely a passing thought with no basis in reality; this is to be ignored and no attention is to be paid to it at all. The second is when there is a great deal of uncertainty, and every time the person does wudoo’ he is uncertain, every time he prays he is uncertain, every time he does any action he is uncertain. This should also be ignored and no attention should be paid to it. The third is when the uncertainty arises after finishing the act of worship. No attention should be paid to that so long as he is not certain about the matter. An example of that is if he is uncertain, after saying the salaam at the end of the prayer, whether he prayed three or four rak‘ahs in a four-rak ‘ah prayer. He should not pay any attention to this uncertainty, because the act of worship has ended, unless he becomes certain that he only prayed three, in which case he should do the fourth rak‘ah, so long as only a short time has passed, then he should do the prostration of forgetfulness after saying the salaam. But if a long time has elapsed, he should repeat the entire prayer.
End quote from Majmoo‘ Fataawa wa Rasaa’il al-‘Uthaymeen (14/90).
The definition of uncertainty that is regarded as intrusive thoughts (waswaas), is when it occurs a great deal. In order to ignore it and not pay any attention to it, it is not stipulated that it should occur in every act of worship, and in every prayer; rather if it happens a great deal to the extent that it becomes a habit, then it is intrusive thoughts (waswaas), even if some acts of worship are free of it. In that case, he should ignore it and pay no attention to it.
It says in ash-Sharh al-Mumti‘ ‘ala Zaad al-Mustaqni‘ (2/299): The one who is affected by intrusive thoughts (waswaas) should pay no attention to his uncertainty. Hence an-Naazim said: Uncertainty after doing an action does not affect anything… This applies if there is a great deal of uncertainty.
If there is a great deal of uncertainty, this is intrusive thoughts (waswaas) and no attention is to be paid to it. End quote.
It says in Mataalib Ooli an-Nuha (1/507): And it is not prescribed to do the prostration of forgetfulness (sujood as-sahw) if there is a great deal of uncertainty, to the extent that it has become like intrusive thoughts (waswaas); in that case he should ignore it. The same applies if there is a great deal of uncertainty regarding wudoo’, ghusl, removal of impurity and tayammum. He should ignore it, otherwise it will become like a kind of stubbornness, which will lead to adding something to the prayer when one is certain that it is complete. So he must ignore it and pay no attention to it, for that reason. End quote.
Shaykh Muhammad ibn ‘Ulaysh noted a guideline from the Maaliki fuqaha’ regarding the uncertainty that should be ignored and no attention paid to it; the guideline is that it occurs every day, even if only once. However, if it comes one day and not another, then it is not intrusive thoughts (waswaas).
It says in Fath al-‘Ali al-Maalik fi’l-Fatwaa ‘ala Madhhab al-Imam Maalik (1/127): The guideline on what is to be regarded as persistent uncertainty is that it occurs every day, even if only once, whether the thing that is the subject of uncertainty is always the same, or it varies, such as one day the uncertainty has to do with his intention, and on another day it has to do with the opening takbeer, or al-Faatihah, or bowing, or prostrating, or the salaam, and so on. But if it comes to him one day and not the next, then this is not consistent and it must be ignored.
See also: Mawaahib al-Jaleel (2/19-20).
And Allah knows best.