Regarding the operative question, I’ll discourse on the Platonic dialog Menexenus, followed by the chapter from Tolstoy’s The Death of Ivan Ilyich, then share my conclusions.
In Menexenus, Socrates is advising Menexenus on the composition of a funeral oration. It’s a given, prima facie, that the intended audience is the living. It’s a rhetorical exercise, of sorts, riffing on a funeral oration attributed to Pericles (ghost authored by Aspasia). That threw me for a bit, as it’s been over 50 years since I read the original oration and was unaware of Socrates’ modifications until rereading it the other day.
In brief, Socrates begins by praising the dead based on their nature, nurture, education, and deeds. The war dead serve as role models for their sons. They are paragons of virtue in upholding Athenian freedom and ideals. Finally, there is consolation for the parents of the dead, who are assured that the City-State will take care of them.
In The Death of Ivan Ilyich, we have the quintessential organization man who puts his career aspirations ahead of his family and friends. Callously, on learning of Ivan’s death, his colleagues see one less competitor on the corporate ladder. Even his wife seeks to free hidden assets from his estate. (This is a negative commentary on the societal status quo.)
It is in the flashbacks to Ivan’s life that we witness a revelation. Though he has achieved material success, it has been at the cost of relationships with his family and friends. The inflection point is an accident in which Ivan is gravely injured, feels great pain and spirals to his death. In the decent into decrepitude, he finds opportunities for self-reflection.
He achieves an epiphany—in part as a consequence of a revelatory dream—that material pursuits and pleasures left him empty. The artificiality of his life imprisoned him. He comes to accept death, loses his anxiety, and achieves senses of peace and redemption.
There are lessons for the dying and their survivors in both readings. In keeping with Socratic/Platonic ideals, it is important to leave a legacy that ensures the sustainability of civilization—and aspirationally—improves upon it. From Tolstoy we are reminded that in life one should deprioritize material acquisition and status-seeking. One should also reflect upon one’s life and consider the effects of life choices on those nearest and dearest. To paraphrase a cliché, the examined life is more fulfilling.
In so doing, one can achieve a sense of peace while dying, or at least some solace to the moment of drawing one’s last breath.
In conclusion, I don’t think there is an algorithm to weigh the “impact” of death in quantitative or qualitative terms on the living or the dead. There’s the quandary of a double effect in play, and no Summa Theologica towards its resolution.