We benefit from this Hadith that whoever stands with the imam until he has completed the prayer, it is equivalent to spending the whole night in prayer. This reward (the reward of spending the whole night in prayer) is not attained by anyone except the one who stands with the imam for the whole prayer, until he completes it, as the Prophet (sal Allahu alaihi wa sallam) said in the above Hadith.

As for the one who prays as much as he can and then leaves before the imam has completed his prayer, only what he has prayed will be recorded for him, but it will not be recorded as if he spent the entire night in prayer.

Regarding the issue whether it is more rewarding to pray Tarweeh alone or in congregation, Imam Al-Nawawi (may Allah have mercy upon him) said in ‘Al-Majmoo’:

“Praying Taraweeh is Sunnah according to scholarly consensus… It is permissible to offer this prayer alone or in congregation, but which is better? There are two well-known opinions on this matter. The correct view according to the consensus of our companions is that praying it in congregation is better. The second view is that it is better to pray it individually.”

It says in ‘Tuhfat al-Ahwadhi’: In the book on night prayer (Qiyaam):

“It was said to Ahmad ibn Hanbal (may Allah have mercy upon him): Do you prefer a man to pray with the people in Ramadan or on his own? Hesaid: He should pray with the people. He said: And I prefer that he should pray with the imam and pray Witr with him. The Prophet (sal Allahu alaihi wa sallam) said: “If a man prays qiyaam with the imam until he finishes, it will be recorded as if he spent the rest of the night (in prayer).” Ahmad (may Allah have mercy upon him) said: “He should pray with the people until he prays Witr with them, and he should not leave until the imam leaves. Abu Dawood (may Allah have mercy upon him) said: I saw him (Imam Ahmad) – in the month of Ramadan, praying Witr with his imam, except on one night when I did not attend. Ishaaq (may Allah have mercy upon him) said: I said to Ahmad: Is praying qiyaam in Ramadan in congregation dearer to you or praying on one’s own? He said: I prefer that this prayer should be offered in congregation, so as to revive the Sunnah. And Ishaaq said the same.”

Shaykh Ibn ‘Uthaymeen (may Allah have mercy upon him) said, “At first the Prophet (sal Allahu alaihi wa sallam) used to pray Taraweeh in congregation in the mosque, then he stopped because he feared that it might be made obligatory upon his ummah… No man should keep away from Taraweeh prayer lest he misses out on the reward for it. And he should not leave until the imam finishes Taraweeh and Witr, so that he may attain the reward of spending the whole night in prayer.”

Shaykh Al-Albaani (may Allah have mercy upon him) said in ‘Qiyaam Ramadan’:

“Rather it (praying Taraweeh in congregation) is better than praying it alone, because the Prophet (sal Allahu alaihi wa sallam) did it himself and explained its virtue. Rather he did not lead them in praying it in congregation for the rest of the month because he feared that praying at night during Ramadan might be made obligatory for them, and they would be unable to do that, as it says in the Hadith of ‘Aa’ishah which is narrated in al-Saheehayn (Sahih al-Bukhari andMuslim) and elsewhere. This concern no longer applied after the Prophet (sal Allahu alaihi wa sallam) died and Allah had completed Islam. Hence the reason for not praying in congregation when offering night prayers in Ramadan was no longer present, and the previous ruling remained in effect, which is that it is prescribed to offer this prayer in congregation. Hence ‘Umar (radi Allahu anhu) revived it, as it says in Sahih al-Bukhari and elsewhere.”