This is a man who knew he was dying and decided to make his own eulogy by levitating 2 meters off the ground and firing lightning into Jean-Claude Van Damme, just so that kids could watch.''
Tony: Definitely didn't picture my demise like this. I'd always figured going out like Cagney in "White Heat" - fiery explosion. Or Redford and Newman in "Butch Cassidy" - hail of bullets!
Gibbs: Or Charlie Chaplin in "The Gold Rush."
Tony: How did he die?
Climb to the top of the world
And as you stand tall you will see
That when you fall
You will fall from a height most men have never reached.
— The Protomen, "The Fall"
Shot down in a blaze of glory
Take me now but know the truth
'Cause I'm going down in a blaze of glory''
— Bon Jovi, "Blaze of Glory"
You want my treasure? You can have it! I left everything I gathered together in one place. Now you just have to find it.
—Gold Roger, setting off the entire plot of One Piece at his execution.
Once you decide that you're going to have the death of Spock, then how does that affect the other people? Why is it there? I got a lot of stick from a lot of people from the very beginning about the idea of killing Spock. Somebody said, "You can't kill him." And I said, "Sure you can; the only question is whether you do it well."
— Nicholas Meyer, Director of Star Trek II: The Wrath of Khan
Now to be honest, I'm actually really against character death in general. Why take away the ability to tell stories about them? But if you're going to kill a character, here's a tip. If you really must kill a character, you make sure it's their Crowning Moment of Awesome, the instant where the readership looks at that character and says "Oh that is the most badass thing I've ever seen!"
Here are two examples:
First, there's the pre-Crisis Supergirl. [...] Get this: The Anti-Monitor, the biggest bad guy of them all, is ready to blow up all of reality. So what does Supergirl do? She punches him. And punches him, and punches, and punches and punches and just wails on the guy until one lucky blast from the Anti-Monitor kills her. But her death had meaning. It had soul. It showed a character dying to save lives. She wasn't just some victim or shock death. She forced the heavily-injured Anti-Monitor to retreat.
Or hell, how about Doctor Octopus? Yeah, he died once too. He returned, but when they decided to kill him off, they knew he shouldn't go out like a pansy. They spent half the issue with him fighting and scoring a few good hits before he died, because the writers knew you had to honor the legacy of the character.
Bottom line, if a character's going to die, they'd better go out swingin'!
— Linkara, describing this trope (and inspiring this trope page)
There is one way to never see your country come to ruin, and that is to die in the last ditch.
— King William III of England (the origin of the phrase "last-ditch")
The Flash bursts into flames, which is pretty harsh, but don't pretend that isn't the most badass way to go out. When you get to heaven after dying by way of exploding from going too fast, you get a high-five from God.
The rise and fall of Tony Montana, and what a way to go out.
In anger smites | the warder of earth,
Forth from their homes | must all men flee;
Nine paces fares | the son of Fjorgyn,
And, slain by the serpent, | fearless he sinks.
— Voluspa, stanza 56, describing Thor's defeat, and death by venom, of the serpent
This is a cool way to die!
— Fry being carried off by a robot pterodactyl, Futurama