These hadeeths are related to the virtues of the Night Prayer.
Aboo Hurayrah reported that the Prophet ﷺ said, “The best month for observing Saum (fasting) after Ramadan is the month of Allah, al-Muharam”. Fasting in the month of Ramadan is one of the pillars of Islam and it is obligatory according to unanimous agreement. The month of Muharam is the best month for voluntary fast. On the basis of this, fasting in the month of Muharam is among the recommended fasts since it is the best after the obligatory fasting.
But the point of reference in this hadeeth is “The best Salat after the prescribed Salat is Salat at night.” This is a proof with exception. The voluntary prayers in the night are better than the voluntary prayers during the day. The exception are the regular optional prayers which accompany the obligatory prayers which are generally better than voluntary prayers at night. For example, the four rak'ah with two Taslim regular optional prayer before Zuhr and the two rak'ah after it are better than six rak'ah during the night because it is an emphasized regular Sunnah which accompany the obligatory prayer. As for general voluntary prayer, the night is better than the day. Hence, he said, “The best Salat after the prescribed Salat is Salat at night”.
As for the first and second Hadeeth of Ibn Umar, may Allaah be pleased with him and his father, they are evidence that the night prayers are in pair of two rak'ah. Imam Ahmad said, “If he stands for the third rak'ah forgetfully, it as if he stood for the third rak'ah in Fajr prayer.” That is, it becomes obligatory for him to return, otherwise his Salat is null and void.
Thus, if you were praying pairs of two Rak'ah at night, but you stood for the third rak'ah due to forgetfulness, it becomes obligatory for you to return even if you have started reciting Fatihah; otherwise, your Salat will be invalid. This is because the Messenger of Allah ﷺ said, "Salat during the night should consists of pairs of two." That is, pairs of two but he exempted the Witr prayer which may be performed as three rak'ah, five rak'ah, seven rak'ah or nine rak'ah.
So if Witr is performed as three rak'ah, he may make the Taslim (the saying: As-salamu alaykum to end the prayer) after the first two rak'ah and perform the third rak'ah alone. Alternatively, he may combine the three rak'ah together with one Taslim. If he performs Witr as five rak'ah, he may join all of them together with one Taslim and one Tashahhud.
Similarly, if he performs Witr as seven rak'ah, he may join all of them together with one Taslim. If he performs Witr as nine rak'ah, he may join all of them altogether with one Taslim. However, he may sit after the eighth rak'ah, perform Tashahhud without Taslim, then stand up to observe the ninth rak'ah and end the prayer with the Taslim. If he performs Witr as eleven rak'ah, he should say the Taslim after every two rak'ah as done by the Prophet ﷺ.
In the first and second hadeeth of Ibn Umar is evidence that Witr is not after dawn; the period of Witr ends with the appearance of the dawn. If sleep overpowers him, which makes it impossible for him to perform it before daybreak, he should perform it during the day. However, he will observe even numbers: if his habit is to observe Witr as three rak'ah, for example, he should observe four rak'ah; and if his habit is to observe it as five rak'ah, he should observe six rak'ah, and so on.
These hadeeths are regarding the virtue of the Night Prayer and its modalities: it should be in pairs of two.
As for the hadeeth of Anas bin Malik, may Allah be please with him, it contains evidence that the Messenger of Allah would perform righteous deeds sometimes such that you would always see him doing it. If you wish to see him praying at night you will see him and if you
wish to see him sleeping at night you could see him. Similarly, with regard to fasting, if you wish to see him fasting you could see him and if you wish to see him not fasting you could see him. That is, the Prophet ﷺ would always follow that which is best and most beneficial.
Sometimes, he would persist on fasting and at other times he would persist on observing prayer at night. Likewise, he would unceasingly skip fasting sometimes and at other times he would sleep continuously. This is because he ﷺ would always follow that which is best, most pleasing to Allah and most comfortable for his body because a person has right over himself. The Prophet ﷺ said this to Abdullah bin Amr bin Al-'As, may Allah be pleased with him and his father: "Your body has a right over you."
Allah alone grants success.