Numerous reports indicate that ʿUmar (may Allah be pleased with him) gathered the people behind Ubayy ibn Kaʿb, who led them in twenty rakʿahs and then three rakʿahs of witr. This occurred publicly and with the participation of all the Companions present, thereby constituting a consensus on both the manner and the number of this well-attested prayer.
Al-Mughnī states: “Tarāwīḥ is a sunnah instituted by the Prophet ﷺ; it was not something newly introduced during ʿUmar’s caliphate. It is one of the hallmarks of the religion. According to most scholars it consists of twenty rakʿahs, and this is the preferred view of Ahmad, Abū Ḥanīfah, and al-Shāfiʿī. Mālik held that it is thirty-six rakʿahs, relying on the practice of the people of Madinah. Our evidence is that when ʿUmar assembled the people behind Ubayy ibn Kaʿb he led them in twenty rakʿahs.”
It is also related from ʿAlī (may Allah be pleased with him) that he ordered a man to lead the people in Ramadan with twenty rakʿahs, and this amounts to consensus.
Sabil al-Salām states: “Al-Bayhaqī reported that ʿAlī used to lead them in twenty rakʿahs and perform witr with three; this report is strong.”
Shaykh al-Islām Ibn Taymiyyah said: “The Prophet ﷺ did not set a fixed number for the night prayer of Ramadan; he himself did not exceed thirteen rakʿahs, though his rakʿahs were lengthy. When ʿUmar gathered the people behind Ubayy ibn Kaʿb he prayed twenty rakʿahs with them and then three rakʿahs of witr, shortening the recitation in proportion to the increase in rakʿahs, for that was easier for the congregation than lengthening a single rakʿah. Some of the early generations performed forty rakʿahs followed by three of witr, while others performed thirty-six and then three.”
All of this is well known. Whichever of these numbers a person employs when leading the people in Ramadan, he has acted commendably. Whoever thinks that the Prophet ﷺ fixed a specific number for the Ramadan night prayer that must neither be increased nor decreased is mistaken.