"Know a man for years. Live with him, share his bread and water, speak with him on every subject. Then tie him up and hold him over a volcano's edge. On that day, you shall finally meet that man."
— Chinese warrior-poet Xiang Yu
Death tends to bring what is really important to the fore, and last words are a character's expression of who they really are. Whether they are
going out with a bang,
saying heartfelt farewell,
facing death bravely, or
expressing no regrets, it makes for great drama.
Tropes:
What if you don't live by a volcano? I suspect the trope description was being poetical.