The following piece is to a large extent adapted from a piece by Nechama Leibowitz in Studies In Bamidbar, and on an article by Alexander Klein. I am also indebted to a dear student who assisted me greatly in learning and writing up these ideas.
G-d can provide protection any physical threat, of course with G-d on your side one need not fear superstitious chants. Bilam himself conveys the idea that Chazal express as Ein Mazal LeYisrael / אין מזל לישראל- there is no power of constellation over Israel (Shabbat 156a) (this is the generally accepted ruling, but there is a minority opinion and the many sources that seem to take mazal seriously are discussed in this Hebrew article), Ki Lo Nachash BeYaakov VeLo Kesem BeYisrael – there is no divination in Jacob and no sorcery in Israel (Bamidbar 23:23). The pervasive question regarding this parsha is; why does God cancel Bilam’s curse and turn it into a blessing?
Some say G-d's interference was to teach Bilaam a lesson and to set an example for the world. An alternate approach is that psychologically this curse would have affected the Jews, thus God protected them from the psychological damage (this, like other answers, assumes that the Jews knew of the curse, despite the fact that this is never stated as the story is told).
Rav Yosef Ibn Caspi in his Tirat Kesef says “ a true friend will save his colleague any pain even if he knows no danger will issue. Similarly the Almighty out of the abundance of his love for Israel prevented Bilam from cursing them though he was aware that his curses were impotent. But the Almighty did not rest content with this. He went so far as to make Bilam bless the people to give them pleasure."
Abarbanel, from a slightly different angle, suggests that if Bilam cursed the Jews other nations would have become more courageous and attacked as well. The fact that the curse was turned to blessing prevented other nations from attacking. We see in Joshua 2:9 that Rachav says the people feared Am Yisrael and it makes sense that this was true in light of Bilam’s blessing and might not have been true had he publicly recited his curses.
Another possibility is offered by Shadal - Rav Shmuel Dovid Luzzatto: The Jews were forbidden to fight with Moav (Devarim 2:9). If Bilam had uttered his curse Moav would have felt it was the curse that caused the Jews to refrain from attacking them. God’s act of turning the curse to a blessing created a Kiddush Hashem instead of a Chilul Hashem.
Rav Meir Simcha off Dvinsk, in his Meshech Chochmah, writes that the blocking of curse and subsequent blessing served to both boost the confidence of The Jews and to weaken the resolve of their opponents. He adds that the fact that the donkey spoke in front of the elders of Midian made it clear that Bilam's blessing was not due to a Jewish payoff, nor was it a fluke in any way. just as G-d made the donkey speak, He caused this blessing to emanate from Bilam.
(The Rambam - Moreh Nevuchim 2:6 - is of the opinion that the donkey did not actually speak. He consistently marshals this view, saying that the people of Sedom were not blinded by seeing angels, Yaakov did not wrestle with an angel, etc. he Abarbanel is also of this opinion and answers questions that arise in particular cases. He explains, for example, that Yaakov came out limping even though his fight was a dream due to the psychosomatic effect. The Abarbanel also is of the opinion that the first speaking animal, the snake, did not speak. In each of these cases a person saw or heard the gestures of an animal and this sparked the viewer to experience an internal dialogue. Chava imagined the nachash saying that "If I can touch the tree, you can too." Bilam got the message from the donkey's braying that, "You are acting imnnapropriately.")
Anselm Astruc suggests God canceled this curse so that when the Jews sinned no one would say that their suffering was because of the curse. God wanted to make it clear that the Jewish People's suffering is the result of the act of their Father in heaven chastising them for their disobedience. Astruc sees God’s action as having a long term effect, not being merely a statement for that moment in time. In his opinion, the point was to make clear for future generations that suffering comes as Divine punishment because failure to understand this would be a Chilul Hashem.
I recently saw a video of an impressive "mind reader." In an interview, he explained what he does is not magic, but a skill. There is brilliance in what he does. he watches for signs and takes clues and then decides if people are lying or what choices they've made in their minds. I know some people who have this knack, this man though is outstanding. And when you seem him do it, it seems supernatural. he himself, will tell you that it's not. I thought of this performer when I read Yehezkel Kaufman's take on Bilam (from The Religion of Israel, Chicago 1960, pp. 78-79; 84-8, cited by Alexander Klein in his 2003 article). He points out that from the text it definitely seems that Bilam's powers were real and therefore taken seriously. He explains that Bilam had a rare wisdom that he applied in a natural way and used for negative purposes. Had he wished to, he could have used his talents for good. (Similarly, as a dear friend pointed out to me, this performer might have become a great Talmudic sage or spiritual advisor had he chosen to channel his talent in that direction.)
It is possible, as Kaufman suggests, that G-d blocked Bilam's curse because he - somehow - had an ability to curse others (maybe to psych them out, to create a bad vibe), therefore G-d stopped him from cursing the Jewish People. The lesson then is that no-one, no matter how clever, can outsmart G-d or fight the will of G-d. Today we have increased and seemingly miraculous technology and wisdom, yet we must remember that our advances are nothing compared to the power of G-d. As Dovid HaMelech summed it up, "רבות מחשבות בלב איש ועצת ה' היא תקום" - "many are the thoughts in the heart of man but the will of G-d prevails."
May we be blessed through our studying Parshat Balak to incorporate into our daily lives an added awareness of G-d's love and of His power.
Rabbi Neil Fleischmann