Praise be to Allaah.
What is mustahabb during the nights of Ramadan is to spend them in qiyaam, prayer and worship, and to single out the last ten nights for extra worship and striving, seeking forgiveness and mercy and seeking Laylat al-Qadr which is better than a thousand months.
Moreover, Taraaweeh prayer is regarded as a kind of Qiyaam al-layl and they call it Taraweeh because people take brief breaks between rakâahs. Hence the matter is broad in scope, and it is permissible for a person to pray whatever he wants of rakâahs, at whatever time of the night he wants.
It says in al-Mawsooâah al-Fiqhiyyah (34/123):
There is no difference of opinion among the fuqahaâ with regard to it being Sunnah to pray during the nights of Ramadan (Qiyaam al-layl), because the Prophet (blessings and peace of Allah be upon him) said: âWhoever spends the nights of Ramadan in prayer, out of faith and seeking the reward of Allah, his previous sins will be forgiven.â
The fuqahaâ said: Taraweeh is the qiyaam (Qiyaam al-layl) of Ramadan. Hence it is best to spend most of the night in it, because it is Qiyaam al-layl. End quote.
What many imams do nowadays -- especially in the last ten days of Ramadan -- leading the people in Taraweeh prayer immediately after âIshaâ, then going back to the mosque in the last part of the night to pray qiyaam, is something that is prescribed and it is not forbidden. There is no reason to suggest it is not allowed. What is required is to strive hard in the last ten days according to one's ability. If a person breaks up his night between prayer, resting, sleeping, and reading Qur'aan, then he has done well.
Shaykh âAbd-Allaah Abaabateen said, as is narrated in al-Durar al-Saniyyah (4/364):
In response to what some people do of objecting to the one who prays more during the last ten days of Ramadan than he usually did in the first twenty days, on the grounds that this is more than is usual and is ignorance of the Sunnah and the practice of the Sahaabah, Taabiâeen and imams of Islam,
We say: There are hadeeths from the Prophet (blessings and peace of Allah be upon him) which encourage praying Qiyaam al-layl during Ramadan, and particularly emphasise it during the last ten days.
Once it becomes clear that there is no specific number of rakâahs for Taraweeh, and that the time for it according to all scholars is from after the Sunnah of âIshaâ until the break of dawn, and that spending the night in worship is a confirmed Sunnah, and that the Prophet (blessings and peace of Allaah be upon him) prayed taraweeh for many nights in congregation, then how can anyone object to the one who prays more during the last ten nights than he did at the beginning of the month? So during the last ten days, he prays at the beginning of the night, as he did at the beginning of the month, or a little, or a lot, without praying Witr, for the sake of those who are weak and want to limit themselves to that; then after that he does more prayers in congregation and calls all of it qiyaam or taraweeh.
Perhaps the one who objects to that is confused by what many of the fuqahaâ say, that it is mustahabb for the imam not to pray more than one includes than one khatmah (reading of the entire Qurâaan), unless the people behind him prefer to do more than that. The reason they gave for not doing more than one khatmah is the hardship that may be caused for the people behind him, not because doing more than that is not prescribed in shareeâah. So from their wording we may conclude that if people behind him want to do more than one khatmah, that is good, as was clearly stated in the words of the scholars.
As for what many of the common people say, calling what is done at the beginning of the night Taraweeh and the prayers offered after that qiyaam, this is what the uneducated people say. Rather all of it is qiyaam and taraweeh. The qiyaam of Ramadaan is called Taraweeh because they used to have a rest (yastareehoona) after every four rakâahs because they used to make the prayers lengthy. The reason why some people object to that is that it is contrary to what is customary among the people of their countries and most of the people nowadays; and because of ignorance of the Sunnah and reports and of the practice of the Sahaabah, Taabiâoon and the imams of Islam; and because of what some people think, that our prayer during the last ten days is a kind of salat al-taâqeeb which was regarded as makrooh by some scholars, but that is not in fact the case, because taâqeeb is a voluntary prayer offered in congregation after finishing Taraweeh and Witr.
This is how all the fuqahaâ defined taâqeeb, as a voluntary prayer offered in congregation after finishing Witr immediately after Taraweeh. From these words it is clear that prayer offered in congregation before Witr is not taâqeeb. End quote.
Shaykh Saalih al-Fawzaan said in Ithaaf Ahl al-Eemaan bi Majaalis Shahr Ramadaan:
In the last ten days of Ramadan, the Muslims increase their efforts in worship, following the example of the Prophet (blessings and peace of Allah be upon him) and seeking Laylat al-Qadr which is better than a thousand months. Those who pray twenty-three rakâahs at the beginning of the month break it up during the last ten days, so they pray ten rakâahs at the beginning of the night, calling it Taraweeh, and they pray ten at the end of the night, making them lengthy, and following it with three rakâahs of Witr, which they call qiyaam. This is a variation in naming only. In fact all of it may be called Taraweeh or it may be called qiyaam. As for those who pray eleven or thirteen rakâahs at the beginning of the month, they add ten rakâahs to that during the last ten days, which they pray at the end of the night, making it lengthy, making the most of the virtue of the last ten days and increasing their efforts to do good. They have a precedent among the Sahaabah and others who prayed twenty-three rakâahs, as stated above. Thus they combine the two opinions: the opinion which favours offering thirteen rakâahs during the first twenty days and the opinion which favours offering twenty-three during the last ten days. End quote.
For more information please see question number 82152.
And Allah knows best.