Bamidbar / Numbers 22:28 · Drash
וַיִּפְתַּח יְהוָה אֶת־פִּי הָאָתוֹן וַתֹּאמֶר לְבִלְעָם מֶה־עָשִׂיתִי לְךָ כִּי הִכִּיתַנִי זֶה שָׁלֹשׁ רְגָלִים׃
And the Eternal opened the mouth of the she-donkey, and she said to Bilam: "What have I done to you, that you have struck me these three times?"
Drash דְּרָשׁ
Without a sword
The one who promises to fell a giant with a word cannot cope even with something small. It happens to us too: big plans, and helplessness in simple things.
The midrash: the Eternal opened the she-donkey's mouth to show that mouth and tongue are in His power. The she-donkey said to Bilam (Balaam): you cannot kill me without a sword, how then do you want to uproot a whole nation with your tongue? Having spoken, she died, so that she would not be worshipped and so as not to shame Bilam: if the Holy One, blessed is He, spares the honour of the wicked, all the more the honour of the righteous.
How Midrash Tanchuma explain it
Midrash Tanchuma And the Eternal opened the mouth of the she-donkey
To let him know that mouth and tongue are in His power: if Bilam (Balaam) wanted to curse, his mouth is in His power. "And she said to Bilam: 'What have I done to you, that you have struck me these three times (רְגָלִים)?'" She hinted to him: you seek to uproot a nation that celebrates three pilgrimage festivals (רְגָלִים) a year. "And Bilam said to the she-donkey: 'Because you have mocked me.'" Though he speaks the holy tongue, a heathen's speech is foul. "If there were a sword in my hand, I would kill you now!" A parable: what is this like? Like a doctor who came to heal with his tongue one bitten by a snake. On the way he saw a lizard and began looking for a stick to kill it. They said to him: this one you cannot overcome, how will you heal one bitten by a snake? So the she-donkey said to Bilam: me you cannot kill unless you have a sword in your hand, how then do you want to uproot a whole nation with your tongue? He fell silent and found no answer. The princes of Moav began to wonder, for they saw a miracle the like of which had never been in the world.
Some say that the princes of Moav asked him: "Why did you not ride on a horse?" He said to them: "It is not mine." The she-donkey retorted: "Am I not your she-donkey?" He said: "Only for loads." "On which you have ridden." He said: "Only now and then." "All your life to this day." This means he was not old: the she-donkey was older than he. "Have I ever been in the habit of doing so to you?" As soon as she spoke, she died, so that people would not say: "This is the she-donkey that spoke", and make her an object of worship. Another explanation: the Holy One, blessed is He, spared the honour of that wicked one, so that they would not say: "This is the one through whom Bilam was struck." And if the Holy One, blessed is He, so spares the honour of the wicked, all the more the honour of the righteous.
And so it says: "And if a woman approaches any animal to lie with it" (Vayikra / Leviticus 20:16). If the woman sinned, how did the animal sin? But since harm came to the woman through it, Scripture says: it shall be killed. Another explanation: so that the animal would not pass through the market and people say: "This is the animal through which such-and-such a woman was killed." This shows how the Holy One, blessed is He, spares the honour of His creatures and knows their needs, and He closed the mouth of the animal. For had it spoken, it could not have been made to serve or be managed: this one is the most foolish of animals, and that one the wisest of the wise, and as soon as she spoke, he could not stand up to her.
Takeaway
The midrash reads "three times" (שָׁלֹשׁ רְגָלִים) as "three festivals": רֶגֶל means both "time" and "pilgrimage festival".
The holy tongue (לְשׁוֹן הַקֹּדֶשׁ) is the Hebrew of the Torah. The midrash notes that Bilam (Balaam) speaks it, and yet his words are coarse.
The law of the animal with which a woman sinned is in the Torah (Vayikra / Leviticus 20:16).