The story of Bilaam and his donkey has confused people for many years. A talking donkey makes many people confused- even Bilaam himself! If this perplexed the greatest scholars, what are we to make of it?
It says 22:24, "And God opened the mouth of the she-donkey and said to Bilaam: What have I done to you that you have struck me these three times?" Since God is indeed mentioned in the text, we know that Hashem is directly responsible for this phenomenon. The question is, how?
Nehama Leibowitz brings forth quite an interesting peyrush on the matter. She quotes the Mishnaic commentary Tiferet Israel, saying, "This was on the first eve after the creation. But this does not imply that they were actually created them, It cannot be assumed that the Ram for the sacrifice of Isaac discovered by Avraham and Bilaam's donkey existed, on the basis of this, for thousands of years and that scriptures would not even mention this great miracle. What is meant is that creation had been invested by God with the power of bringing forth these wonders at the appropriate time."
What this means is that right before Shabbat on the sixth day, Hashem created the potential in the world. This potential was brought into the world much later but there was, and always will be that potential.
The phrase 'If walls could speak' comes to mind. Bilaam must have been very surprised when his donkey started to speak. I bet he didn't like the stories the she-donkey had to tell either.
While everyone else seems perplexed, Rambam, who aids such people, finds no such issues with it. He assumes the whole encounter between Bilaam, the donkey, and the angel was in a prophetic vision from Hashem. How un-creative of him.
Ramban happens to be more concerned as to why the she-donkey is able to see the angel at all! I mean, if you were stuck with Bilaam, wouldn't you be looking for a miracle too? But he does bring up an interesting point.
In more words, he asks: if the donkey was able to see the angel, why couldn't Bilaam? Did he need glasses or something?! He rejects this approach and redirects.
"but it is plausible that God, the one who added to the She-donkey the power of speech, also added to its power of visual perception and, as a result, it saw as a person sees. And the reason the scripture does not state regarding the donkey 'and god uncovered the eyes of the she-donkey,' as it states regarding it's master Bilaam is because the entire matter of the donkey was a great miracle, indeed like a new creation, IE., something completely different than anything in existence previously, listed among the things that were created during twilight at the end of the Friday of creation and it cannot be called just an 'uncovering of the eyes.' However, our sages, of blessed memory, mention only the opening of the donkey's mouth among the miracle-objects created during twilight."
He says that Hashem granted the sight to the donkey along with the speech, and because it was so extraordinary, it could not stam be put out there like Bilaam in the commonplace happenings. Thankfully, all of these commentaries exist for us to understand their answers, and get to the bottom line of what happened.