The presentation and import of Parshas Balak pose a few fundamental questions. Firstly, why was it necessary for the Torah to record the entirety of the story of Bilaam's involvement with Balak and Bilaam's attempts to curse Bnei Yisroel? Would it not have been simpler for the Torah to briefly note that Bilaam tried to curse us and that Hashem converted Bilaam's words into berachos? In the case of Nachalei Arnon (Bamidbar 21:15), the account of God preventing the Emorim from attacking the Jews and His crushing of the Emorim was condensed into a few pesukim. Why do we need to know the whole episode of Bilaam, including his negotiations with Balak's messengers, the dialogue with the donkey, the details of Bilaam trying to attain prophecy via korbonos, and so forth? The basic point could surely have been made without the elaboration and punch-by-punch detail.
Secondly, the text of Bilaam's blessings was incorporated into the Musaf Shmoneh Esrei of Rosh Hashanah as well as other parts of our liturgy; why was this done? Although the berachos pronounced by Bilaam were truly miraculous in light of the intervention by Hashem to stifle the words that Bilaam really planned to say, why was it necessary to adopt the words of the vile Bilaam for our tefillos? The same core messages that Bilaam conveyed can be found in other parts of Tanach and Rabbinic literature; why not quote from there and avoid association with Bilaam?
It is stated regarding the account of Bilaam that "...vayahafoch Hashem Elokecha l'cha es ha-klalah li-v'racha...". (Devarim 23:6) This is commonly translated as "...and the Lord your God changed the curse into a blessing..." However, the connotation of the word "vayahafoch" is perhaps misunderstood. In other contexts, the shoresh (root-word) "hafach" has a quite deep, vivid interpretation. In the story of Esther, "v'nahafoch" refers to a state of total paradox, such that every facet of the tale was "reversed" ["nahafoch"] so as to form a completely new state of affairs. So, too, the word "mahpecha", also from the "hafach" shoresh, means "upheaval". "Hafach" connotes a full reworking and redefining of events rather then a mere change. "Hafach" is used to describe an total, extreme reversal of fortune and fate, such as "Hafachta mis'pedi l'machol li" - "You reversed my mourning into dancing" (Tehillim 30:12). The complete redefining of Dovid Hamelech's life was best described by the shoresh "hafach".
We can now understand why the entire story of Bilaam had to be narrated in full detail, as every facet of the account forms part of a larger picture of Hashgacha P'ratis (Divine Providence) in which each factor necessarily contributes to and culminates in a complete and unexpected reversal of what was planned. The "minor" events leading up to the tale's climax were crucial for the outcome. It was essential for Bilaam to be warned by Hashem not to curse the Jews and to heed His dictates, and it was also necessary for Bilaam to be granted permission by Hashem to go along with Balak's emissaries. Had Bilaam been barred from going, or had he gone without warning and with the intent to disobey God, he would not have attained the state of prophecy necessary to intimate Hashem's messages of beracha. So, too, it was necessary for Bilaam's donkey and the malach (angel) to counter Bilaam while he was on his trip, not in communication with Hashem, in order to dispel Bilaam's notion that he could undermine God when not in His presence; this enabled Bilaam's true positive prophecy. Additionally, had Bilaam not demonstrated a great measure of haughtiness commensurate with his level of nevu'ah, he would have grossly abused his prophetic powers. (See Derech Hashem 3:4:4 for basics of the prophetic state.)