Rashi in his commentary to Bereshis 25:30 says that Avraham died 5 years earlier than he would have otherwise, in order to not witness his grandson Esav engage in bad behavior:
https://mg.alhatorah.org/Dual/Rashi/Bereshit/25.30#m7e0n6
מן האדום האדום – עדשים אדומות. שאותו היום מת אברהם, שלא יראה את עשו יוצא לתרבות רעה, ואין זו שיבה טובה שהבטיחו המקום, לפיכך קיצר חמש שנים משנותיו.
However, the Gemora in Brachos 18b-19a seems to conclude that dead people are aware of what is going on in the world:
https://www.sefaria.org/Berakhot.19a.1?lang=bi
"וְאִי סָלְקָא דַעְתָּךְ דְּלָא יָדְעִי, כִּי אָמַר לְהוּ מַאי הָוֵי? אֶלָּא מַאי — דְּיָדְעִי? לְמָה לֵיהּ לְמֵימַר לְהוּ?! לְאַחְזוֹקֵי לֵיהּ טֵיבוּתָא לְמֹשֶׁה."
So...if Avraham knows what is going on in the world after dying, what is the benefit of dying before Esav goes bad?