What does this posuk teach us about the correct pattern of prayer?
(33,2) “And he said: Hashem came from Sinai and shone forth from Seir to them; He appeared from Mount Paran and came with some of the holy myriads; from His right hand was a fiery law for them.”
The Yalkut Shimoni in the name of the Sifri comments that our posuk teaches us that Moshe did not start to mention the needs of Yisrael in his prayer before he first declared the praises of Hashem. This is like an advocate who was hired to speak on behalf of a certain person to the king - he first mentioned the praises of the king before he introduced the needs of the man, and also concluded with the praises of the king. Here also, Moshe Rabbeinu first mentioned the praises of Hashem, as it says “And he said: Hashem came from Sinai…”, and afterwards he started to mention the needs of Yisrael, as it says “And He was King in Yeshurun…”. He then went back and concluded with the praises of Hashem, as it says “Yeshurun, there is none like G-d…”.
And Shlomo Hamelech also first started with the praises of Hashem, as it says in Divrei Hayomim Ⅱ(6:14) “Hashem, G-d of Yisrael, there is no G-d like You in the heavens or in the earth, Who keeps the covenant and the kindness with Your servants who walk before You with all their heart”. Afterwards he introduced the needs of Yisrael, as it says in 6:28 “If there be famine in the land…”, and then went back and concluded with the praises of Hashem, as it says in 6:41 “And now arise Hashem, G-d, to Your resting place…”. Similarly, the Shemoneh Esrei prayer that the Sages established for Yisrael starts with the praises of Hashem - “The great, mighty and awesome G-d…”, and concludes with “we give thanks to You…”, and the needs of Yisrael are mentioned in the middle.
This Midrash helps to explain the gemora in Shabbos 30a which explains that which Shlomo Hamelech wrote in Koheles 4:2 “I praise the dead who have already died more than the living who are still alive” with the teaching of R. Yehudah in the name of Rav, who said: What is meant by the posuk in Tehillim 86:17 “make for me a sign for good, and let those who hate me see it and be ashamed”. Said Dovid before Hashem: Master of the World, forgive me for that sin (that he committed with Bas Sheva). Hashem replied: You are forgiven. He said to him: Make for me a sign in my lifetime. Hashem replied: In your lifetime I will not make it known, but in the lifetime of Shlomo, your son, I will make it known. For when Shlomo built the Beis Hamikdash he sought to bring the Holy Ark into the Holy of Holies, but the gates clung together. Shlomo uttered twenty-four entreaties but still was not answered…But as soon as he said “Hashem, G-d, do not turn away the face of Your anointed one; remember the kind deeds of Dovid, Your servant”, he was immediately answered. At that time the faces of Dovid’s enemies turned (black) like the bottom of a cauldron, and all the people and all Yisrael knew that the Holy One, Blessed be He, had forgiven him that sin.
Now, I heard that one of the great Torah sages was bothered by the gemora’s statement that after Shlomo mentioned the merits of his father, Dovid, he was immediately answered. Because since he had already said twenty-four entreaties and then said “remember the kind deeds of Dovid ”, how can we know if he was answered because of this last statement alone or because he had now said twenty-five entreaties? So how can they positively state that “he was immediately answered”, which implies that this merit alone allowed Shlomo to bring in the Holy Ark?
In addition to this I myself noticed another very big problem, that here it implies that when he said “Remember the kind deeds of Dovid” he was answered and he brought in the Holy Ark, but in the posukim it says afterwards only that “when Shlomo finished to pray the fire came down from the heavens and consumed the burnt offerings and the sacrifices”, and does not mention anything about the bringing in of the Holy Ark!
But according to the Yalkut in the name of the Sifri the matter is very clear. Because Chazal were bothered why Shlomo changed from the normal pattern of prayer and did not conclude with the praises of Hashem, as Moshe Rabbeinu, the Men of the Great Assembly, and even he himself had done. Instead he concluded his prayer here with “remember the kind deeds of Dovid, Your servant”!
This is what Chazal came to answer by saying that as soon as he said “remember the kind deeds of Dovid” he did not have time to conclude with what he had intended, namely with the praises of Hashem, because immediately he was answered by the opening of the gates and the bringing in of the Holy Ark. Therefore, since his prayer had already been answered what need was there to continue his prayer? And all this was because Hashem wanted to make known to everyone that He had forgiven Dovid and had accepted his repentance, and therefore he was answered immediately after mentioning the merit of Dovid.
However, lest his enemies should claim that the reason that Shlomo was not allowed to conclude with Hashem's praises was because He did not desire Shlomo's praises of Him (like it says in the gemora in Ta’anis), therefore it says “when Shlomo finished praying (that fire should come down), fire came down and consumed…”. That is, that prayer was not answered until after he had totally completed his prayer in the normal way. Only then did fire come down because Hashem did desire Shlomo’s praises. But with the prayer that he prayed concerning the opening of the gates he was answered immediately on mentioning the kind deeds of Dovid, his father, in order to make known that Hashem had forgiven him and completely accepted his repentance. This seems to me to be a very correct explanation.