The time for the witr begins as soon as the late ‘Ishāʾ prayer has been offered and continues until daybreak. In the two Ṣaḥīḥs it is narrated from ʿĀʾishah (may Allah be pleased with her): “The Messenger of Allah observed witr during every part of the night—at its beginning, its middle, and its end; yet he would finish his witr in al-saḥar (the pre-dawn hours).”
Many other reports likewise indicate that the whole night is a valid time for the witr, with the sole exception of the period before ‘Ishāʾ. Therefore, whoever is confident that he will rise in the last third of the night should delay his witr until then, for that is superior. But the one who fears he will not wake up should perform witr before going to sleep; this is what the Prophet recommended. Muslim transmits on the authority of Jābir that the Prophet said: “If any of you fears he may not rise at the end of the night, let him pray his witr first and then lie down; but whoever is sure he will rise at the end of the night, let him pray witr then, for the recitation at that time is witnessed, and that is better.”
The least that suffices for witr is a single rakʿah, as established by several hadiths and affirmed by ten of the Companions (may Allah be pleased with them). Nonetheless, the better and more comely practice is to precede it with an even-numbered rakʿah (al-shafʿ).
The maximum number for witr is eleven or thirteen rakʿahs, which one performs