It is narrated from Hattan bin Abdullah (may Allah have mercy on him) who states that Ali (may Allah be pleased with him) said: "Witr is of three types. Whoever among you wishes to perform it in the first part of the night, let him do so. Then, if he wakes up, he may, if he wishes, make it even by adding one rak'ah and then pray two by two rak'ahs until the true dawn appears. And if he wishes, he may perform witr in the last part of the night."
Hadith Referenceمسند الإمام الشافعي / كتاب الصلاة / 396