When he awoke, he would first clean his teeth with a tooth-stick, then remember Allah—what he would say upon waking has already been mentioned—then purify himself and pray two brief rak‘ahs. As reported in Sahīh Muslim (1), ‘Ā’ishah said: “When the Messenger of Allah, peace and blessings be upon him, rose to pray at night, he would begin his prayer with two brief rak‘ahs.”
He also instructed others to do this in the hadith of Abū Hurayrah, saying: “When any of you rises to pray at night, let him begin his prayer with two brief rak‘ahs.” Reported by Muslim (2).
He would sometimes rise halfway through the night, or shortly before or after that. At other times, he would rise when he heard the rooster crow; it crows only in the second half of the night.