Praying to Allah remained a common thing in the message of all prophets which Allah sent before his final messenger Muhammad (PBUH).
Today 1.5 billions muslim offer their prayers in the footsteps of Muhammad (PBUH), but how did the prophet learnt the method of prayer?
The answer is simple through the wahi of Allah. There are many narrations about this matter but the most clear narration is in Sahi Bukhari in which Jibreel came and he prayed 5 times in front of Muhammad (PBUH) and our beloved prophet followed him in the same manner after each prayer.
At the end of the prayers he told that I was ordered to do so (from Allah). This hadith indicates that Allah himself taught Prophet Muhammad (PBUH) how to pray through Jibreel.