How were the numbers of rakats and the ways to perform prayer determined?
Acts of worship are tawqifi, which means that it is not possible to know their reasons for being fardh and their practices with logic in all aspects. The issues related to the acts of worship are generally commanded in the Qur’an and were explained in more detail with the practices of the Prophet Muhammad (saw).
It is expressed in the Qur’an that prayers are obligatory to be established in certain times (Nisa, 4/103), and that they have some pillars such as qiyam, qira’at, ruku, and prostration; details and the required acts were determined and fixed with Prophet Muhammad’s (saw) sunnah (Bukhari, Adhan, 95; Muslim, Salat, 45, Masajid, 176; Abu Dawud, Salat, 150; Ibn Majah, Salat, 1; Tirmidhi, Salat, 114). As a concise explanation, the Prophet (saw) said, “Pray as you have seen me praying.” (Bukhari, Adhan, 18). According to this, general judgment on prayer is that its pillars and conditions are determined by the Qur’an and the details about them are determined by the sunnah of Prophet Muhammad (saw).
Source: Presidency Of Religious Affairs The Turkey, High Board of Religious Affairs FATWAS