If the imam did not pray Witr and they prayed qiyaam with him until he finished and left, will they be regarded as having spent the night in prayer?
Question

At this time of coronavirus, we are not allowed to pray in the mosques, but myself and some friends of mine gather to pray ‘Isha’ and Taraweeh, and we agreed among ourselves to leave Witr until the end of the night, so that we can pray it with our families at home. Then a shaykh came to us and told us that we have to pray Witr and finish the prayer in accordance with the Sunnah [by praying Witr], and in order to attain the reward of having spent the night in prayer. He quoted to us a hadith: “Whoever prays qiyaam with the imam until he finishes, it will be recorded that he spent the night in prayer.” Please note that we all, each one of us, pray two rak‘ahs of qiyaam, then they all leave my house. And he told us that when Sayyiduna ‘Umar told the people to come together to pray qiyaam in Ramadan, they prayed eleven rak‘ahs, so you should pray eleven rak‘ahs. We said to him: We complete our prayer at home, but he said to us: Pray Witr and change it after you finish, then pray whatever you wish with your families, then pray Witr at the end of the night. So we prayed qiyaam and changed Witr. Is our agreement to delay Witr contrary to the sunnah?
Praise be to Allah.Firstly:
There is nothing wrong with the imam leading a congregation in praying Taraweeh without praying Witr, so that everyone can pray Witr at the end of the night, and there is the hope that they will be included in the hadith which was narrated by an-Nasaa’i (1364), at-Tirmidhi (886), Abu Dawood (1375) and Ibn Maajah (1327) from Abu Dharr, who said: We fasted Ramadan with the Messenger of Allah (blessings and peace of Allah be upon him) and he did not lead us in praying qiyaam during any part of it, until there were seven nights left. He led us in praying qiyaam on the night of the twenty-third until approximately one-third of the night had passed. Then on the night of the twenty-fourth he did not lead us in prayer. Then he led us in praying qiyaam on the night of the twenty-fifth until almost half the night had passed. We said, O Messenger of Allah, would that we had offered naafil prayers throughout the whole night. He said, “If a man prays with the imam until he finishes, he will be reckoned to have spent the whole night in prayer.” Classed as saheeh by al-Albaani in Saheeh an-Nasaa’i.
Thus the reward mentioned in the hadith is attained by praying behind the imam from the beginning of his prayer until he finishes praying and leaves, whether he prays Witr or not.
Shaykh Ibn Baaz (may Allah have mercy on him) was asked: If someone prays Taraweeh with his imam but he does not pray tahajjud with him at the end of the night, is he regarded as having spent the whole night in prayer?
Answer: If someone prays qiyaam with the imam until he finishes praying and leaves, Allah will decree for him the reward of spending one night in prayer, if his imam led them in prayer at the beginning of the night, and led them in praying Witr too. If he then prays more with someone who prays at the end of the night, there is nothing wrong with that, but he should not pray Witr twice. If he prays Witr with the first imam, he should not pray Witr again with the second one; he may pray whatever he is able to, but he should not pray Witr again. If he does join the prayer the second time the imam prays Witr, he should make it even-numbered by adding a rak‘ah, because the Prophet (blessings and peace of Allah be upon him) said: “There should not be two Witrs in one night.” This is what the Prophet (blessings and peace of Allah be upon him) said. So if he prays Witr in the Haram, for example, or somewhere other than the Haram, with the first imam and prays Witr with him, then he should not pray Witr with the second imam, but he can pray with the second imam whatever he is able to, but he should not pray Witr. If he does pray with him when he prays Witr, he should make it even-numbered by adding a rak‘ah, because the Prophet (blessings and peace of Allah be upon him) said: “There should not be two Witrs in one night.”
End quote from Fataawa Noor ‘ala ad-Darb (9/460).
There is nothing in the hadith to suggest that the reward for spending the entire night in prayer cannot be attained unless the imam leads the people in praying Witr too.
What was narrated about what the Sahaabah (may Allah be pleased with them) did cannot be regarded as a condition that must be met in order to attain the virtue mentioned in the hadith; rather that is something that they did.
Similarly, what is best is to pray Witr with the imam, unless one is going to pray again in congregation at the end of the night. The reason why it is better to pray qiyaam and Witr with the imam is that this is what the Prophet (blessings and peace of Allah be upon him) did when he led his companions in prayer, then this is what his companions did later on, even though they used to pray at the beginning of the night.
Muhammad ibn Nasr al-Mirwazi narrated in Qiyaam al-Layl (p. 217) that Jaabir (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) prayed eight rak‘ahs and Witr one night during Ramadan. The following night, we gathered in the mosque, hoping that he would come out to us, and we kept waiting there until morning came. [The Prophet (blessings and peace of Allah be upon him)] said: “I did not want and I was afraid that Witr would be made obligatory for you.”
Maalik narrated in al-Muwatta’ (4) from as-Saa’ib ibn Yazeed, that he said: ‘Umar ibn al-Khattaab instructed Ubayy ibn Ka‘b and Tameem ad-Daari to lead the people in praying eleven rak‘ahs. He said: And the reciter would recite hundreds of verses, until we would lean on sticks because of standing for so long, and we would not leave until it was very close to the time of Fajr.
The best is for the imam to pray Witr, and for those who are praying behind him to make it even-numbered by adding a rak‘ah, then if he (the imam) wishes he can pray at the end of the night, without praying Witr again.
It says in Kashshaaf al-Qinaa‘ (1/427): If the one who wants to pray tahajjud (later in the night) wishes, he may follow an imam in praying Witr, then when the imam says the tasleem, he can make the rak‘ah he prayed even-numbered by adding another rak‘ah. Then when he prays tahajjud, he can pray Witr, and thus attain both the reward of following the imam until he finishes, and the reward of making Witr the last of his prayers (at night).
If someone prays Witr, in congregation or on his own, then it occurs to him that he wants to offer voluntary prayers after that – that is, after he has prayed Witr – he should not change his Witr and make it even-numbered by adding a rak‘ah, because of the words of ‘Aa’ishah, who was asked about one who changed his Witr, and she said: That is someone who is tampering with his Witr. Narrated by Sa‘eed and others. He may pray two rak‘ahs by two, however much he wishes, until it is very close to dawn, because it is narrated in a sound report from the Prophet (blessings and peace of Allah be upon him) that he used to pray two rak‘ahs after Witr, and he did not pray Witr (again), because he had already prayed Witr before his tahajjud, and he said: “There should not be two Witrs in one night.” Narrated by Ahmad and Abu Dawood from Qays ibn Talq from his father, but Qays is not reliable. End quote.
However, what appears to be the case is that if gathering is restricted, as mentioned in the question, and they will all pray with their families when they return home, there is no blame on them and it is not makrooh (disliked) for them all to delay Witr until the end of the night. Rather it seems that this is what is best for them, because the Prophet (blessings and peace of Allah be upon him) said: “Make the last of your prayer at night Witr.” Narrated by al-Bukhaari (998) and Muslim (751).
See also the answers to questions no. 37729 and 216236.
Based on that, the virtue of delaying Witr, so long as you are confident that you will not miss it, and you will pray in congregation at home, is better than praying Witr earlier with the first congregation, for those who will resume praying after they pray Witr. And there is the hope that in this case all the person’s deeds will be in accordance with various aspects of the Sunnah, and that they will not miss out on the reward of spending the night in prayer, by praying with the imam.
Secondly:
Having a number of imams for Taraweeh does not matter,  because they come under the same ruling as a single imam. So the one who prays qiyaam with them until they finish praying will attain the reward.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked: If someone prays Taraweeh with the first imam then leaves, and says: I have prayed qiyaam according to the text of the hadith, because I started with the imam and finished with him, is this valid?
He replied: With regard to the hadith: , “Whoever prays qiyaam with the imam until he has finished, it will be recorded that he spent the night in prayer,” this is saheeh.
But when there are two imams in one mosque, are they each regarded as separate and independent of one another, or is each of them like a deputy for the other?
What appears to be the case is the latter, that each of them is like a deputy for the other and  the actions of one are complementary to those of the other.
Based on that, if there are two imams who lead the prayers in the mosque, then these two imams are to be regarded as being like one imam, so the individual should stay until the second imam finishes praying, because we know that the actions of the second imam are complementary to those of the first.
Based on that, what I advise my brothers to do is to follow the imams here in the Haram until they have completely finished praying.
End quote from Majmoo‘ Fataawa wa Rasaa’il Ibn ‘Uthaymeen (13/436).
And Allah knows best.