So this does not contradict what we have stated, that whoever speaks deliberately during the prayer must repeat the prayer, because the one who forgets and gives the ‘taslim’, then speaks afterward, did not intentionally speak while still regarding himself in a state of prayer. Rather, he spoke thinking he had completed the prayer, and this is like the case of someone who speaks during prayer believing he is not in prayer. However, if he had remembered that something from his prayer was still remaining, and then deliberately spoke after that, it would have been obligatory upon him to repeat the prayer, as we have previously clarified regarding the one who deliberately speaks. As for the one who doubts and does not know whether he prayed two rak‘ahs or three: if his assumption leans toward one of them, then he should build upon it and nothing is required of him. But if his assumption is balanced, he should build upon the greater number and complete what he has missed after giving the ‘taslim’. We have already mentioned what supports this, and what further clarifies it is what was narrated:
Commentary #20