i would love if you answer my query that is, how should i pray the remaining rakahs of witr if i have joined the witr congregation in the 3rd rakah. Should i raise my hands and recite dua when the imam says takbeer for Dua e Qunoot (his 3rd rakah, my first) or should i just keep my hands tied and do nothing and recite the dua qunoot in my 3rd rakah (after i get up to pray my remaining rakahas after the imam has said the tasleem)
It sounds strange that you joined a congregation at the third raka'a of witr.
Note that it is only permissible to pray it in congregation during Ramadan, as for other months there's no backup in the sunnah that the prophet () or his companions () ever offered witr in a congregation. In fact praying sunnah and nafl prayers alone and at home is the highest recommendation. I know that hanafi's deviate here and declared witr wajib based on very weak narrations, which in fact don't support their claims.
Having said that let's go into your question.
You must follow your imam in the positions and order of the prayer until the salam
The answer is simple as said in the comments you have to follow your imam in a congregation:
The Prophet (ﷺ) said, "The Imam is to be followed. Say the Takbir when he says it; bow if he bows; if he says "Sami'a l-lahu liman hamidah", say, " Rabbana wa laka l-hamd", prostrate if he prostrates and pray sitting altogether if he prays sitting."
(Sahih al-Bukhari, Sahih Muslim elsewhere)
On raising hands for du'a al-Qunoot
Therefore you should follow your imam until he performs (at least) the first salam. Note that the majority view is that raising hands is part of the du'a and an established sunnah, there even seem to be a hadith for a case of Qunoot an-Nazilah in which the prophet () raised his hands, but it wouldn't make any difference in the validity of the prayer whether you did it or left it. The maliki view -I'm not aware of others opposing this majority view- here is that it isn't part of the acts of the prayer therefore they reject it.
On how to proceed
As for whether or not you should repeat du'a al-Qunoot this depends on the scholarly views:
First of all for many scholars du'a al-Qunoot is only a recommendation so skipping it won't make your prayer invalid, faulty or incomplete (so skipping it intentionally or unintentionally doesn't require sujud sahw), but if that isn't the case according the scholarly view you are following, you shall do it and consider doing sujud sahw if you missed it. Let's now assume Qunoot is sunnah for you so skipping it would require sujud sahw, or more general how should you continue if you want to perform du'a al-Qunoot in the correct manner based on the stage in which you joined the prayer?
For a person who joined a prayer later there are two known scholarly views. Which imam an-Nawawi has explained in his al-Majmoo' المجموع شرح المهذب -see here in Arabic- and the following analysis is based on his explanation there. I'll basically translate from Arabic please take my translation with the necessary care.
- View saying: What this person performed with the imam is the beginning of his prayer (there's no matching between the order of the imam and that of the ma'mum), in this case the person must go on as if he was to pray his next raka'as. Let's say you've joined in the third raka'a of the imam this third raka'a for the imam was your first raka'a and therefore your next raka'a is the second and then follows the third in which Qunoot is done.
This view is held by Sa'id ibn al-Musayyib, al-Hassan al-Basry, 'Ata', 'Umar ibn 'Abd al-'Aziz, Makhool, al-'Awza'iy, Sa'id ibn 'Abd al-'Aziz and Ishaaq, it was also narrated from 'Umar (), 'Ali (), abu a-Dardaa', but it is not certain and it is one of the statements of the imam's Malik, Dawood (a-Dhahiri) and is the leading position held in the shafi'i madhhab.
The main evidence for them is the Sahih hadith:
"When you hear the Iqama, proceed to offer the prayer with calmness and solemnity and do not make haste. And pray whatever you are able to pray and complete whatever you have missed.
(Sahih al-Bukhari and elsewhere)
- View saying: What this person performed with the imam is, as is for the imam and he must now perform qada' of what he missed (the order in the prayer of the ma'mum is matching that of the imam and he must go ahead in the correct order: starting from first raka'a). That means in your case the third raka'a of the imam was your third raka'a too and therefore you've already performed the du'a in the third raka'a, your next raka'a however is the qada' the first raka'a and the following one would be the second raka'a for you.
This is based on a variation of the above hadith where the crucial words "فأتموا" (literally: "complete it" or "go ahead") was replaced by "فاقضوا" (literally: "make it up" or "offer it later") according to imam an-Nawawi both variations were compiled by al-Bukhari and Muslim however the first by more roots. Imam an-Nawawi supported the view of his madhhab (shafi'i) by a comment of imam al-Bayhaqi saying that those people who reported the first variation on the authority of abu Hurairah are closer to him and know him better than the others.
This second view is held (according to imam an-Nawawi) by the imams abu Hanifa, Malik, a-Thawry and Ahmad and by ibn al-Mundhir (from the shafi'i's) who also reported it as the position of ibn Sereen, Mujahad and ibn 'Umar().
Here -again- the first version from Sunan abi Dawod, it includes a reference to the second in the long comment of abu Dawod I've also linked a version of this second below from Sunan an-Nasa-i:
I heard the Messenger of Allah (may peace be upon him) say: When the iqamah is pronounced for prayer, do not come to it running, but come walking(slowly). You should observe tranquility. The part of the prayer you get(along with the imam) offer it, and the part you miss complete it(afterwards).
Abu Dawud said: The version narrated by al-Zubaidi, Ibn Abi Dhi’b, Ibrahim b. Sa’d, Ma’mar, Shu’aib b. Abi Hamzah on the authority of al-Zuhri has the words: “the part you miss then complete it”. Ibn ‘Uyainah alone narrated from al-Zuhri the words “then offer it afterwards”. And Muhammad b. ‘Amr narrated from Abu Salamah on the authority of Abu Hurairah, and Ja’far b. Rabi’ah narrated from al-A’raj on the authority of Abu Hurairah the words “then complete it”. And Ibn Mas’ud narrated from the Prophet(ﷺ) and Abu Qatadah and Anas reported from the Prophet( may peace be upon him) the words” then complete it”.
(See a full quote of the second version in Sunan an-Nasa-i)
Salafi scholars at least on islamqa (see fatwa islamqa #126777 in Arabic -also available in Urdu) consider the first view as the most correct.