Due to its unique structure the Quran has briefly mentioned the outline of Islamic teachings (like Ahkam, Aghaed, History, etc.) and has assigned the prophet of Islam to explain it in detail and interpret it. After executing the abovementioned task, the prophet passed down this responsibility to the Ahlul-Bayt by Allah's decree.
As with other Ahkam, the Quran has mentioned the concept of prayer and the times it should be performed in, but has left the rest of the details like the number of rak’ats to the prophet to explain, and the prophet has done so. Therefore the number of rak’ats for each prayer has been mentioned by the Ma'someen (The fourteen infallibles) which are the "Speaking Quran".
Due to its unique structure the Quran has briefly mentioned the outline of islamic teachings (like Ahkam, Aghaed, History, etc.) and has assigned the prophet of Islam to explain it in detail and interpret it. At the same time after executing the abovementioned task the prophet granted this authority to the Ahlul-Bayt by Allah's decree; because according to the Quran the prophet of Islam possesses four positions:
1- The responsibility of receiving revelation and holy messages which has been mentioned in several Quranic verses.
2- The responsibility of conveying revelation and the holy messages.
3- The responsibility of explaining and interpreting the holy revelations.
The prophet must interpret the Quran and explain it to the people so that they can understand the word of Allah in the Quran. In regard to the prophet's responsibility of explaining revelation, the Quran says: "We have sent down the reminder to you so that you may clarify for the people that which has been sent down to them, so that they may reflect."
4- The responsibility of executing Quranic teachings and the Ahkam and Allah's decrees. After the prophet passed away two of the mentioned tasks had been accomplished while the two other, meaning "explaining revelation" and "executing Quranic teachings" remained. According to the hadith of Thaqalain that both Shias and Sunnis have agreed on and many other Ahadith, the Imams hold these two positions. 
Mansoor Bin Hazem says that I told Imam Sadegh that I had a debate with a group of people and told them that the prophet was Allah's representative on earth and he has passed away, so who is the representative of Allah after him? They said that the Quran is Allah's representative after the prophet. When I referred to the Quran I found that the Quran is in a way that all people including Atheists, Harooris, the Murji’ah and all other sects can use to their own benefit, therefore I understood that the Quran is in need of a guardian that knows the interpretation of its verses, and because I did not find anyone with such features among people except for Imam Ali, I declared that Imam Ali is the interpreter and guardian of the Quran and after him his children, meaning Hasan, Hussein, Ali and … will be the interpreters and the guardians of the Quran.
Therefore these Ahadith indicate that the Quran has explained its teachings in a brief and general manner and that the Ma'someen have been assigned to explain them in detail and interpret the verses for the people. The concept of prayer is no exception in the Quran, because the Quran has mentioned the fact that it is obligatory to pray in several verses and it has also explained the time the prayers should be performed in, but does not go further than that. In the Quran the Almighty says: "Maintain the prayer from the sun's decline till the darkness of the night, and [observe particularly] the dawn recital. Indeed the dawn recital is attended [by the angels of day and night]."
Therefore the very concept of Salat has been mentioned in the Holy Quran but explaining the details and the number of rak’ats and the Ahkam regarding Prayer is the responsibility of the "Speaking Quran", which would be the Ma'someen. The Prophet and the Imams have explained the number of rak’ats each prayer consists of either through their speech or their actions. We will mention one hadith as an example in which they have mentioned the number of rak’ats:
In his book Tahzib, Sheikh Tusi narrates a hadith from Fathl Bin Yasar which he has heard from Imam Sadegh. In this hadith the Imam says: "The (total) number of rak’ats in Wajib prayers and the Nawafel (Mustahab prayers) is 51, among which 17 are wajib and 34 are mustahab."
 Like Baqarah:252; Ale Imran:58 and 108; Jathiyah:9; Qasas:3.
 Najm:3 and 4.
 " أَنْزَلْنا إِلَیْکَ الذِّکْرَ لِتُبَیِّنَ لِلنَّاسِ ما نُزِّلَ إِلَیْهِمْ وَ لَعَلَّهُمْ یَتَفَکَّرُون. " Nahl:44.
 Sahih Tirmidi, vol. 5, pg. 621.
 Usul Kafi, vol. 1, pg. 192, hadith 3.
 Wasa’ilul-Shia, vol. 18, chapter 131, pg. 1330.
 Prayer has been mentioned in 82 verses of the Holy Quran, like verses3, 43, 45, 83, 110, 125, 153, 177, 238, 277 from surah Al Bagharah
 Tahdhibul-Ahkam, Sheikh Tusi, vol. 2, kitabul-salat, first chapter, hadith 2.