How to Pray Tahajjud and Witr
Question

How can a person pray Witr and tahajjud? If we pray Witr after sleeping, during the last third of the night, then how can we pray tahajjud after it? Does tahajjud come before Witr or after it?
Praise be to Allah.Firstly:
What is Qiyam al-layl?
Qiyam al-layl means spending the night, even if it is only for a short time, in prayer, reading Quran, remembering Allah (dhikr), and other acts of worship. It is not stipulated that it should take most of the night.
What is tahajjud?
With regard to tahajjud , it is (voluntary) prayers at night. Some scholars stipulate that it is prayers at night that are offered after having slept.
However the view of most of the jurists is that it refers to any prayers offered at night.
How to offer prayers at night
What is prescribed with regard to prayers at night is that the prayers should be offered two rak‘ahs by two, then the worshipper should end his prayers with one rak‘ah, so as to make the prayers odd-numbered.
Ibn ‘Umar narrated that a man asked the Messenger of Allah (blessings and peace of Allah be upon him) about the prayers offered at night. The Messenger of Allah (blessings and peace of Allah be upon him) said: “The night prayers are two by two, then if one of you fears that dawn may come, he should pray one rak‘ah, which will make what he has prayed odd-numbered.” (Narrated by al-Bukhari (946) and Muslim (749)
How to pray tahajjud and witr
From that it is clear that the Sunnah with regard to tahajjud and Witr includes several things:

The worshipper should offer his prayers two (rak‘ahs) by two, so he should separate each two rak‘ahs of his prayer with the taslim.
He should start with tahajjud first, and pray as much as Allah wills that he should pray.
Witr should be the last of his prayers at night. The Prophet (blessings and peace of Allah be upon him) said: “Make the last of your prayers at night Witr (lit. odd-numbered).” (Narrated by al-Bukhari (953) and Muslim (751).
The worshipper should not delay any of his tahajjud or Witr until the break of dawn; rather he should try to make sure that he has done all of that before the adhan of Fajr.

An-Nawawi (may Allah have mercy on him) said:
“The words of the Prophet (blessings and peace of Allah be upon him),” then if one of you fears that dawn may come, he should pray one rak‘ah, which will make what he has prayed odd-numbered” – and according to another hadith, he said, “Pray Witr before dawn” – indicates that the Sunnah is to make Witr the last of the prayers offered at night, and that the time for it ends with the break of dawn. This is the well-known view in our madhhab, and it is the view of the majority of scholars. It was also said that the time lasts after dawn has broken, until the obligatory prayer is offered.” (Sharh Sahih Muslim, 6/30-32)
Best time for offering prayers at night 
The Muslim may offer whatever prayers he wishes at night, from after ‘Isha prayer until dawn, depending on whatever he is able to to, whether at the beginning of the night, or in the middle of the night, or at the end thereof, with any number of rak‘ahs.
The best time for offering the prayers at night is the end of the night, for it is the time when Allah descends to the first heaven, and the time when the gates of heaven are opened. 
Jabir (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Whoever fears that he will not get up at the end of the night, let him pray Witr at the beginning. Whoever is sure that he will get up at the end of the night, let him pray Witr at the end , for prayer at the end of the night is witnessed, and that is better.” (Narrated by Muslim (755).
If he prays at the beginning of the night, then prays Witr, then he decides to pray at the end of the night whatever he wishes, two rak‘ahs by two, he should not repeat Witr, for there should not be two Witrs in one night.
And Allah knows best.