In fiction, we remember the deaths that make us sad — ScienceDaily
https://www.sciencedaily.com/releases/2020/12/201217113002.htm
Meaningful deaths (death of someone that redeemed themselves or sacrificed themselves for someone else).
Happy deaths (The hero finally kills the evil villain).
Varies by genre, but across all genres, people tend to remember meaningful deaths more than others.