The correct view is that he should return, because this man began the prayer intending to pray two rak'ahs; so let him pray two rak'ahs and not add to them. In this case, he should perform the prostration of forgetfulness after the salām.
Question: A man is praying at night, and the night prayer is performed two rak'ahs at a time. He forgetfully stands for a third rak'ah; must he return?
Answer: He must return. If he does not return, his prayer is invalid, because he has deliberately made an addition. The Prophet ﷺ said: “The night prayer is two by two” (1). For this reason, Imam Ahmad (2) explicitly stated that if one stands for a third rak'ah in the night prayer, he is like a man who stands for a third rak'ah in the Fajr prayer; that is, if he does not return, his prayer is invalid.
The witr prayer is excepted from this, however, for a person may perform more than two rak'ahs in witr. Thus, if he performs witr with three rak'ahs, it is valid. Accordingly, if a person begins witr intending to pray two rak'ahs, give the salām, and then perform the third, but forgets and stands for the third without giving the salām, we say to him: Complete the third rak'ah, because witr may consist of more than two rak'ahs.
“If two trustworthy persons say ‘Subḥān Allah’ to alert him, but he persists and is not certain that he himself is correct, his prayer is invalid, ...”
His statement, “If two trustworthy persons say ‘Subḥān Allah’ to alert him, but he persists and is not certain that he himself is correct, his prayer is invalid”: “say ‘Subḥān Allah’ to alert him” means that they say, “Subḥān Allah,” in order to draw his attention. This is because what is prescribed for alerting the imam when he adds something to, or omits something from, the prayer is for those behind him to say, “Subḥān Allah,” as the Prophet ﷺ said: “If something occurs during your prayer, then let the men say ‘Subḥān Allah’