There is no doubt that Taraweeh is a Sunnah and is naafil; it is the qiyaam of Ramadan. The same may be said of night prayers, Duha (forenoon) prayer and the regular Sunnah prayers that are offered along with the obligatory prayers. All of them are naafil, so he may do them if he wants or not do them if he wants, but doing them is better.
If he starts to pray Taraweeh with the imam and wants to leave before completing it, there is nothing wrong with that, but staying with the imam until he finishes is better, and it will be recorded for him as if he spent this night in prayer, because the Prophet (blessings and peace of Allah be upon him) said: “Whoever prays qiyaam with the imam until he finishes, Allah will record for him the qiyaam of one night.” So if he stays with the imam until he completes it, he will have attained the virtue of spending the whole night in prayer, but if he leaves after praying some rak‘ahs, there is nothing wrong with that and no sin, because it is naafil. End quote.
Shaykh ‘Abd al-Azeez ibn Baaz (may Allah have mercy on him)