"For now I would also have killed you, [and let her live]" (Numbers 22:33). It does not say "I would have left her," but "I would have kept her alive" — from here we learn that the angel killed her, because she came before the angel together with Balaam for judgment, and the angel killed her. And if regarding the honor of the wicked He was concerned — so that people should not say, "This is the one who rebuked Balaam the prophet and silenced him" — how much more so does the Holy One, blessed be He, concern Himself with the honor of the righteous. This is what is written: "and you shall kill the animal" (Leviticus 20:15).
Why the Angel Killed Balaam's Donkey and Spared Balaam
Midrash Aggadah, Numbers 22:33
כי עתה גם אותכה הרגתי [ואותה החיותי]. אינו אומר הנחתי, אלא החייתי, מכאן שהרגה המלאך, לפי שבאה אל המלאך עם בלעם לדין, והרגה המלאך, ומה בכבוד הרשעים חשש, כדי שלא יאמרו בני אדם, זו שהוכיחה לבלעם הנביא והשתיקתו, על אחת כמה וכמה שהקב"ה חושש בכבודם של צדיקים, הדא הוא דכתיב ואת הבהמה תהרוגו (ויקרא כ טו):