Alqamah (may Allah have mercy on him) narrates that Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) said that the Messenger of Allah (peace and blessings be upon him) led the prayer. Ibrahim al-Nakha'i (may Allah have mercy on him) said: I do not know whether he added something to the prayer or left something out. When he gave the salam, it was said: O Messenger of Allah! Has some new ruling come regarding the prayer? He (peace and blessings be upon him) said: "What is that?" They said: You prayed in such-and-such a way. The Messenger of Allah (peace and blessings be upon him) folded his legs, faced the qiblah and performed two prostrations, then gave the salam. Then, when he turned towards us, he said: "If some new ruling had come regarding the prayer, I would certainly have informed you. But I am a human being like you; I forget just as you forget. So when I forget, remind me. And when any of you is in doubt about his prayer, let him think carefully about what is certain, then complete his prayer on that basis, then give the salam, and then perform the two prostrations of forgetfulness."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3818