Peak–end rule
The peak–end rule is when we judge past experiences mainly by how they were at their peak—the best or worst moment—and how they ended, rather than by the total duration or the average of the whole experience. So a long, mostly dull experience with a good ending can be remembered positively, and a mostly good experience with a bad ending can be remembered negatively.
Examples
A long holiday with one great day and a nice final evening is remembered as a great trip, even if many days in the middle were boring or stressful.
A medical procedure that was painful for most of the time but ended with quick relief is remembered as less bad than one that was mildly uncomfortable throughout.
A concert with a strong finale is remembered as excellent, even if the first half was average.