After two failed attempts at cursing the Jewish people, Bilaam tries a third time:
וַיִּשָּׂ֨א בִלְעָ֜ם אֶת־עֵינָ֗יו וַיַּרְא֙ אֶת־יִשְׂרָאֵ֔ל שֹׁכֵ֖ן לִשְׁבָטָ֑יו וַתְּהִ֥י עָלָ֖יו ר֥וּחַ אֱלֹהִֽים׃ וַיִּשָּׂ֥א מְשָׁל֖וֹ וַיֹּאמַ֑ר נְאֻ֤ם בִּלְעָם֙ בְּנ֣וֹ בְעֹ֔ר וּנְאֻ֥ם הַגֶּ֖בֶר שְׁתֻ֥ם הָעָֽיִן׃ נְאֻ֕ם שֹׁמֵ֖עַ אִמְרֵי־אֵ֑ל אֲשֶׁ֨ר מַחֲזֵ֤ה שַׁדַּי֙ יֶֽחֱזֶ֔ה נֹפֵ֖ל וּגְל֥וּי עֵינָֽיִם׃ מַה־טֹּ֥בוּ אֹהָלֶ֖יךָ יַעֲקֹ֑ב מִשְׁכְּנֹתֶ֖יךָ יִשְׂרָאֵֽל׃
As Bilaam looked up and saw Israel encamped tribe by tribe, the spirit of God came upon him. Taking up his theme, he said: Word of Bilaam son of Beor, Word of the man whose eye is true, Word of him who hears God’s speech, Who beholds visions from the Almighty, Prostrate, but with eyes unveiled: How fair are your tents, O Jacob, Your dwellings, O Israel!
This time, it would seem, Bilaam was finally successful in achieving the state of prophecy he so desired. Strangely, however, Rashi seems to read these verses differently, implying that, quite to the contrary, Bilaam decided to forgo his scheme altogether:
ותהי עליו רוח אלהים. עָלָה בְלִבּוֹ שֶׁלֹּא יְקַלְּלֵם:
AND THE SPIRIT OF GOD WAS UPON HIM — He decided not to curse them.
The first question that needs addressing, then, is why Rashi would read this posuk in a way that seems so counter to its simple and straightforward understanding. Both Targum Onkelos and Targum Jonathan render the verse as meaning that the spirit of God, or prophecy, fell upon Bilaam. Indeed, Bilaam did proceed to speak words of prophecy (24:7). Why, then, does Rashi not read our posuk in its plain sense as meaning simply that Bilaam prophesied?
The second question we must address is more broad: Why is it that Bilaam’s words of “מַה־טֹּבוּ אֹהָלֶיךָ יַעֲקֹב מִשְׁכְּנֹתֶיךָ יִשְׂרָאֵֽל” are such a common and oft-repeated refrain amongst the Jewish people? There are many that even have the custom of reciting this verse upon entering a synagogue. Are we lacking in phrases in the Chumash uttered by righteous individuals that we need turn to an evil man like Bilaam for such things? Why do we have a custom to repeat the words of a rashah? Indeed, Maharshal (Shu”t 64) was not much a fan of this custom for this very reason.
The explanation for all the above likely lies in an observation of Ramban (24:1). The first two times Bilaam attempted to curse the Jewish people, Ramban explains, he planned to do so through his own powers and abilities, and expected God to simply come to him by happenstance as he went about his own business. Due to this, in neither instance did Bilaam actually achieve the level of prophecy he desired in order to curse the Jewish people. The third time he tried, however, he decided to simply turn his face towards the Jewish nation, concentrate on them, and allow God to come to him according to how God saw fit. It was for this reason that on this third attempt God’s presence, and prophecy, finally did come to Bilaam.
If Ramban is correct, Rashi’s words now make sense. Rashi was not reading the posuk against its straightforward meaning; Rashi did not intend to say that Bilaam did not achieve prophecy. Rather, he was explaining that the reason that Bilaam finally did achieve prophecy was because he had resolved not to curse the Jewish people, but instead directed his mind towards God to simply be a conduit for the Divine presence. Rashi was simply explaining what, exactly, Bilaam did on his third attempt that made him worthy of finally meriting prophecy.
Indeed, the lesson to be derived from this episode is clear: There is a great deal of difference between doing God’s will against our own, and doing God’s will because we want to (Dorash Dovid p.177). A person who keeps Torah and mitzvos against his or her own desires will forever live in pain and difficulty. Those who align their own will with God’s, however, will instead serve out of joy and happiness. Certainly, this is something far, far easier said that done, as it is often engrained within our psyche and culture to want that which perhaps God does not want.
Perhaps this, then, is why the first words of Bilaam after he finally conceded to God’s will — “מַה־טֹּבוּ אֹהָלֶיךָ יַעֲקֹב מִשְׁכְּנֹתֶיךָ יִשְׂרָאֵֽל” — have resonated so strongly with the Jewish people throughout the ages. When Bilaam finally directed his heart and mind towards God, and negated his own will and desires in the face of the Divine, only then did he merit prophecy.
In a way, the very first step in our avodas HaShem must be to align our own will and desires with those of God.