What is the ruling on praying with those who pray 20 rakah, and should the person finish with them and pray witr with them?
Some Scholars argue you finish with Imam even if he does twenty.
However, Shaikh Muqbil and Shaikh al-Albani (may Allah have mercy upon them) said that he leaves after 8 or 10.
Shaikh Muqbil rahimahullah was asked:
If I pray in a masjid where the Imam prayers twenty rakat, should I complete twenty with him following the Imam or should I pray with him eight rakah and pray witr alone then leave?
I advise that you pray eight rakah and pray witr alone. Following the Sunnah is more deserving for verily the Prophet sallalahu alayhi wa salam said:
صَلُّوا كَمَا رَأَيْتُمُونِي أُصَلِّي
And pray as you have seen me pray
[Reported al-Bukhari no. 6008]
[Taken from: Fasaaih wan-Nasaaih pg. 86]
And Allah Knows Best
Faisal Ibn Abdul Qaadir Ibn Hassan
Which scholars were of the opinion that you should stay and complete  with the imam?
Shaikh Ibn ul-‘Uthaymeen rahimahullah was of that opinion.
Faisal Ibn Abdul Qaadir Ibn Hassan
Likewise, it is the opinion of the Lajnah
The Lajnah ad-Da’imah was asked the following question:
If a person offers Tarawih [special supererogatory night Prayer in Ramadan] behind an Imam [the one who leads congregational Prayer] who prays it as twenty-three Rak‘ahs and after praying eleven Rak‘ahs, the person leaves the congregation, will this act be complying with the Sunnah?
The Sunnah [action following the teachings of the Prophet] is to finish the Salah [Prayer] with the Imam, even if he offers twenty-three Rak‘ahs, for the Messenger [peace be upon him] said:
Anyone who prays Qiyam (optional Night Prayer) with the Imam until he finishes, Allah will record it for him as spending the whole night in prayer. According to another narration: The rest of their night.
Therefore, it is better for a Ma’mum [person being led by an Imam in Prayer] to continue praying with the Imam until he finishes, whether they offer eleven Rak‘ahs, twenty-three Rak‘ahs, or other numbers.
So, the best to be done is to continue with the Imam until he finishes. However, offering twenty-three Rak‘ahs was observed by `Umar [may Allah be pleased with him] and the Sahabah [Companions of the Prophet]. Accordingly, there is nothing wrong with this or violative of the Sunnah. It was the practice of the Rightly-Guided Caliphs, whose legitimacy is indicated by the Hadith narrated by Ibn ‘Umar (may Allah be pleased with both of them both) that the Prophet (peace be upon him) said: (Optional) Night Prayer is two Rak‘ahs followed by two Rak‘ahs (and so on), and when one of you fears the break of dawn (Fajr Prayer), let them offer a single Rak‘ah to make the Salah they have offered Witr (Prayer with an odd number of units). (Agreed upon by Al-Bukhari and Muslim) The Prophet (peace be upon him) did not specify a certain number of Rak‘ahs. He (peace be upon him) rather said: Night Prayer is two Rak‘ahs followed by two Rak‘ahs (and so on).
But, if the Imam restricts himself to praying eleven or thirteen Rak‘ahs in Tarawih, it will be better; offering Taslim (salutation of peace ending the Prayer) in the end of every two Rak‘ahs. This is the practice of the Prophet (peace be upon him) at most times. This is more considerate of the people who are being led in Salah during Ramadan or at other times. But whoever offers more or less than this number of Rak‘ahs, it is permissible, because the Rak‘ahs of optional Night Salah is a matter open to choice. Allah is the One Who grants success.
Also as a side benefit, Shaykh Muqbil’s opinion is slightly different to Shaykh Albany’s opinion from the angle Shaykh Albany rahimahullah sees the act of praying twenty rak’ahs to be an innovation and that it isn’t permissible whereas Shaykh Muqbil rahimahullah sees otherwise. However, both of them advise with not exceeding over eleven rak’ahs.
Ash-Shaykh Muqbil, rahimahullah, said:
ومن أراد إلى أن يزيد لا نستطيع أن نبدعه ولا أن نقول إنه ارتكب محرماً ، لكن الأفضل الإقتصار على ما فعله النبي – صلى الله عليه وعلى آله وسلم – ،
“… And whosoever wants to increase, then we aren’t able to declare him to be an innovator nor to say he has done something haraam. However, what is preferable is to restrict oneself to what the Prophet sallahu alayhi wa salam, done… ”
Ash-Shaykh Muqbil, may Allah have mercy upon him, said:
“What is foremost and better is sufficing oneself with that which has been narrated of what the Prophet, alayhi as-salaatu was-salaam, performed [i.e. praying eleven rak’ah]… however what remains [in question] is does this increasement/ addition [of praying twenty rak’ah] reach to the level of a bid’ah or not? What is apparent for me is that it does not reach to it [being an act of innovation] due to the generality of the proofs pertaining to the virtues of [increasing in] prostration and rukoo’ and in prayer…”
[Min Fiqh al-Imaam al-Waadi’e (1/350)]
AbdulFattaah Bin Uthman