The notion of not giving in to despair, in the face of death or other hopeless situations and keeping up the fight with all one has left until death finally stakes his claim. A common phrase for this trope is to "go out with a bang", or "go out in a blaze of glory". Death need not be an absolute certainty, but may be seen as inevitable.
It comes in two forms:
Death is certain for character(s), and he/she/they need encouragement to live the last of his/her/their time to the fullest. Their death is normally caused by cancer or other serious health problems. A family member or friend will help them with accomplishing a certain goal or advancing a cause that is important to them.
Either way, the character performs as their last act a deed of great significance to those around them, be it their family, friends, a community, even the entire world. The character(s) basically want to say that if they do die here and now, people will remember it. The character(s) do(es) not die quietly. For heroes, this usually involves righting or avenging some wrong, but can be just a matter of personal pride to make the enemy, or the world, feel their presence one last time. Villains can have their own version, usually in the form of inflicting The End of the World as We Know It out of pure spite or sheer hubris.
Regardless, their end is worthy of great stories and legend, but this is done intentionally by the character's own will and not by happenstance. Others may push the character toward it, but the character still has the option of going gently into that good night.
Compare The Last Dance, It Has Been an Honor, Last Stand.
Contrast Despair Event Horizon (losing all hope), I Die Free (embracing death as an alternative to slavery).
Named after the poem by Dylan Thomas, written to his father.
Macross Frontier has an example in Sheryl Nome, who is given an opportunity to save the fleet because while her illness means her days are numbered, it also means she can affect the Vajra with her song, which may be crucial to Frontier's survival in the Final Battle. Sheryl goes into the last battle expecting to be dead by the end of it, by her infection if not by gunshot.
Something similar happens in the first movie, where Sheryl's farewell concert is interrupted by a Vajra attack, and she goes on singing to bring hope to the soldiers, even if it means attracting the Vajras' attention and getting killed.
In Mobile Suit Gundam, we have General Revil's famous "Zeon is exhausted" speech, mentioned in the backstory but not shown in the anime (it does, however, appear in the novelization). In the first week of the war, The Federation suffered devastating losses to Zeon's mobile suits, Sydney was reduced to a gigantic crater by a Colony Drop, and General Revil was captured. Just when the Feds were preparing to sign the surrender agreement, Revil was rescued by a Federation commando team and made a speech announcing that Zeon had depleted its fighting strength as well and encouraged the Feds not to give up. The speech worked, and the Federation ended up winning the war by hanging on against overwhelming odds until they could develop MS of their own.
In the face of the overwhelming power of Obito and the God-Tree, an entire shinobi army faltered. Thanks to the thoughts of Naruto and Tobirama's pleas, they regain their will to fight.
Subverted in Koihime†Musou. Kannu and Chouun are cut off from all reinforcements and facing an entire bandit gang in their own lair armed only with whatever they could take off their defeated enemies. They exchange true names as people facing death together and decide to go out fighting. They not only live, they managed to wipe out the entire gang between them denying Kousonsan any chance of glory.
In a non-death example (though it may seem like death since American football is Serious Business) in Eyeshield 21, after Kid and Tetsuma are benched due to injuries and the team is painfully aware that they don't have a chance and losing by a large amount of points, Riku refused to let the team throw the game and continued to play against Gao until he dropped.
In One Piece, the Pirate King Gold Roger was dying from an incurable disease. He then conquered the Grand Line, became known throughout the world as the Pirate King, found a lover and had a kid with her, and then turned himself in. Then, at his execution, which the World Government intended to use as a warning to all pirates for what awaits them, turned it into the moment that started the Golden Age of Piracy. Then he laughed, smiling as they lopped off his head.
"My wealth and treasures? If you want it, it's yours. I left everything I gathered in one place. But you'll have to search the entire world!"
Similarly, his Friendly Enemy Whitebeard did the same thing at his own death. As a marine victory was poised to snuff out the Golden Age of Piracy, Whitebeard shouted out his Famous Last Words, reigniting the idea once again, and started an entirely new age of piracy. Those words?
Acqua of the Back loses the will to live when he loses his powers. Shiage Hamazura convinces him to stand up and keep fighting.
Kakine Teitoku tells Accelerator and Shizuri Mugino that their struggle is pointless, because they will go to Hell no matter what they do. Mugino says maybe that's true, but if it is, they might as well kick some ass before they go.
Batman gives one of these speeches to his fellow JLA members, The Flash and Green Lantern (Kyle Rayner) at a time when all hope seems lost and he himself is lying in bed with a dangerously high fever.
"Death is powerless against you if you leave a legacy of good behind. Death is powerless against you if you do your job. My father saved the lives of over four thousand people, one at a time, with his bare hands and his mind. Death was with him the entire time."
In Chapter 12 of Fate/Stay Night fanfic Nerve Damage, Archer Napoleon Bonaparte refuses to kneel before a stronger enemy Servant, and maintains that it would be unfitting of a Heroic Spirit to do anything less than meet his death standing. Impressed by his bravado, Gilgamesh lets him go.
"This is a good death. I will not bend my knee. No hero will bend his knee to a threat." A chuckle. "A good run I suppose, short as it is. I, a hero with a legend barely two hundred years old, to one whose own spans four thousand years back. Perhaps it was hopeless in the beginning, but I matched your power until the very end, and in death, I will meet the standard. I will die standing."
The Last Samurai. Algren persuades Katsumoto to go down fighting instead of committing Seppuku or bowing down to Omura and the forces of corporate Japan and fading into obscurity. What ensues is the last flowering of the Samurai.
The Bucket List is all about this trope. Two men, both with terminal diseases, see how many dreams they can fulfill for themselves before they kick the bucket.
A memorable recitation of the Trope Namer poem takes place at the end of Dangerous Minds, just as the protagonist teacher is about to give up, feeling overwhelmed and impotent to make a difference. Not exactly life or death in that situation, but facing the prospect of being a dedicated, caring teacher for one of the roughest public schools around is pretty daunting too. When her friend asks her why she decided to stay, she answers only "they called me their light..."
Independence Day had the President using this argument as the cornerstone of his Rousing Speech. If the human race is to be wiped out, then they will make certain the aliens remember them.
In fact, he almost uses the trope name word-for-word during his speech:
"We will not go quietly into the night, we will not vanish without a fight..."
The Matrix Revolutions: Mifune's speech to the defenders of Zion just before the Machines invade may qualify:
"All right! This is it! Now you all know me, so I'm gonna say this as simply as I can. If it's our time to die, it's our time. All I ask is, if we have to give these bastards our lives...we give 'em hell before we do!"
DJ Grant Mazzy signing off in Pontypool. With his recording booth besieged by zombies and a trigger-happy military, there's only one thing left to say:
"This is Grant Mazzy for CSLY Radio Nowhere. ...And I'm still here, you cocksuckers."
The protagonists of the third Pirates of the Caribbean film, and not just the immediate fight after a Rousing Speech. Pirates as a whole were phasing out as well. Fighting that one, last hopeless battle to the death might well have been the send-off of their way of life altogether.
Elizabeth Swann: "You listen to me...LISTEN! The Brethren will still be looking here to us, the Black Pearl, to lead, and what will they see? Frightened bilge rats aboard a derelict ship? No, they will see FREE MEN, AND FREEDOM! And what the enemy will see, THEY WILL SEE THE FLASH OF OUR CANNONS, AND THEY WILL HEAR THE RINGING OF OUR SWORDS, AND THEY WILL KNOW WHAT WE CAN DO! By the sweat of our brow, and the strength of our backs, and the courage in our hearts! Gentlemen, hoist the colors!"
In Pacific Rim, the Kaiju and their creators were not expecting humanity to fight back as hard as they do against extinction. Special mention also has to go to the Hansens who, when they have a disabled Jaegar and no other options, start telling Leatherback to "come get some" and fire flares that are about as effective as Spiteful Spit instead of giving up.
This is how Tony Stark gets his call in Iron Man: captured in a cave, shrapnel climbing to his heart, and little hope of rescue. His fellow captive convinces him to fight, and the rest is history.
Yinsen: Is that how you want to go out? Is this the last act of defiance of the great Tony Stark!? Or are you going to do something about-? Tony Stark: -Why should I do anything? They're gonna kill me, you... Either way, if they don't, I'll probably be dead in a week. Yinsen: Well then... this is a very important week for you, isn't it?
Preston in Equilibrium, after learning revolution was a trick of the authority to trap him, decides not to give in easily, and manages to win.
The mindset of the entire cast of heroes in The Lord of the Rings. Of course, Plan A is that Frodo destroys the One Ring, but everyone is well aware that the chances of this being successful are slim.
In The Two Towers when what's left of the Helm's Deep garrison sallies into Saruman's army purely in the name of glory. (And to give the people of Rohan time to retreat into the Glittering Caves)
In The Silmarillion, this is the attitude of most Men, since unlike the Elves they can't wait around for eternity in magically-hidden cities in the hope a miracle will happen.
Turin: Though mortal men have little life beside the span of the Elves, they would rather spend it in battle then fly or submit... though Morgoth slay the doer he cannot make the deed not have been.
A textbook example of how to do it right can be found at the end of Legend by David Gemmell.
The Chronicles Of Thomas Covenant gives us Lord Mhoram's Victory, Revelstone is besieged, it's supplies dwindling, everyone rapidly approaching the Despair Event Horizon, and Lord Mhoram decides that instead of sitting around waiting for hunger and despair to let Lord Foul's minions just walk in without a fight, all the remaining forces ride out in one final fight. Though almost a last stand, a combination of the surprise of there attack, and other factors happening at the same time cause the siege to be broken.
Callahan's Crosstime Saloon: All of the patrons give an epic one to Tom Hauptmann at the end of "The Time Traveller", persuading him that life is worth living.
Harry Dresden, repeatedly and with intent to cause severe property damage. He keeps taking on things fifty times his size and refuses to back down... it's a good thing there are so many badasses watching his back.
If I was to die, I was not going to go out in a gibbering heap of terror. If I was to die, it wouldn't happen because I was half crippled with fear and Sight trauma. If I was to die, it was going to be a bloody and spectacular mess.
More generally, this is the exact attitude a large number of wizards take with their Death Curses. Of particular note is Simon Pietrovich, who didn't take his death lying down - instead he made sure he had a lot of company at the Gates.
River Marked, in the Mercy Thompson series, has the various Native American Spirits fight as hard as they can while knowing that defeat is inevitable.
One of the themes of the final book in the Song of the Lioness series. Runaway princess Thayet describes how when faced with a life of imprisonment, her mother's final act was to become a martyr to inspire and protect her people. Alanna feels that this was a useless act, thinking its always better to live to fight another day. By the end of the book, she understands the importance of this trope, after Liam undergoes a Heroic Sacrifice of this nature to save the kingdom.
D'Argo from Farscape. The last time you ever see him, he has been fatally wounded and is holding back a group of super soldiers with two rapid fire energy weapons while telling them exactly who their daddy is.
3 of the final episodes are called "We're So Screwed". They don't go gentle, they go awesomely.
The Grand Finale of Angel. Angel and the rest of his crew decide to assassinate the Circle of the Black Thorn and, at least temporarily, sever the Senior Partners' connections on Earth, and not one of them expect to survive the Partners' inevitable retribution. Of course, as revealed in the canonical comic continuations, they not only survive, but go on to fight another day.
Babylon 5 has a villain's version of this. With Sheridan's rebellion on the verge of success, President Clark programs the automated defense satellites of Earth to turn their guns on Earth itself, then kills himself.
A straighter version is the speech G'Kar gets during his Dust-induced hallucinations, by a nameless Narn who is later revealed to be Kosh.
Narn: If we are a dying people, then let us die with honour by helping the others like no one else can.
Londo noted how the humans, during the Earth-Minbari war, knew they were doomed because of their lesser technology, but fought back even more strongly after every defeat (as he narrated we are shown a few examples of this, including a man trying to stand back up and fight after being knifed to death). He was quite impressed. Ironically, humanity was saved when The Minbari surrendered, which baffled everyone ( they had discovered that each race was carrying some of the other's DNA—their races had crossed 1,000 years ago, as is revealed in season 3).
In season 2, Sheridan insists Kosh teach him how to fight the Shadows so he can one day take the fight to them. Kosh warns, "If you go to Z'ha'dum, you will die." But Sheridan invokes the trope and stands firm, "Then I die, but I will not go down easily and I will not go down alone." Fast-forward to the final episode of season 3. He's on the Shadow's homeworld and, having run out of room for negotiation, proves he's ready to keep the promise he made to Kosh. He has his spaceship crash into their largest city and detonate bombs with a combined force of one gigaton of TNT. All that's left later is a crater. He does die eventually...and then gets better.
The re-imagined series of Battlestar Galactica, in the finale the titular ship can't last longer in space, so rather than going to be scavenged for parts, Adama decides to bring her in a final ultimate full-on assault on the Cylon's frakking headquarter with the sole mission objective of saving a little girl. It worked.
The Brunnen-G of Lexx were doomed to die at the hands of His Divine Shadow. While the older generation of Brunnen-G welcomed their inevitable death due to being weary of their immortal existence, a few of the younger ones led by Kai refused to die lying down. Their brave but futile assault is shown in the very beginning of the series and is later re-enacted in the Musical Episode "Brigadoom".
Master of Ceremonies: The half a dozen little craft went forth against the might power of the Divine Order. Not really believing that they would win, for the Prophecy had told them that they would not, but knowing that they would die well!
In the last episode of Stargate SG-1 the Asgard accept their demise as a species and rather than slowly fading out of existence they finally grant the Tauri the entirety of their knowledge and equip the human ships with the pinnacle of Asgard technology as their legacy. After that they self-destruct what remains of their once great people, timing the explosion to take out a few last Ori warships.
Daniel Jackson: "I mean, all they wanted to do was live a little longer. We're no different. Sequence DNA. Cure diseases. One fatal mistake, and they doom their entire race. I guess no matter what you do, at the end of the day… life is too short."
In Grey's Anatomy Christina gives one of these in the Season Eight Finale.
The fourth episode of ER was titled "Into That Good Night" and the key plot was that of a man who would die before the day was out if he did not receive a heart transplant. Throughout the day, the doctors did everything possible to keep him alive while frantically searching for a donor. . .all to no avail.
The Craftworld Eldar were driven to the brink of extinction by a great tragedy, and now exist as scattered survivalists seeking refuge among the stars. All their gods save three are dead, slain by a Chaos God of their own creation, who is now hunting their race down with the intent to consume their souls. Not only that, but their most ancient and powerful foes are rising from their tombs. Beset by enemies on all sides just like the Imperium and crippled by a low birth-rate, they are doomed in the long run and very unlikely to succeed in these goals, and they know it. However, they hope that they can deliver a final end to their ancient foes and use their souls to create a god of death which will curbstomp said Chaos God and free them from their curse. Until that goal is realized, they will keep fighting to the bitter end.
StarCraft II has the last mission of the Protoss mini-campaign. Achievements are awarded based on how many enemies you take down before you are wiped out. In multiplayer matches continuing to fight once it's hopeless is generally considered very poor etiquette and angers opponents.
Dragon Age: Origins, depending on what you did, has Alistair wishing to do this by killing the Archdemon as his first and final act as King of Ferelden so he could be remembered as one of the good ones.
In Mass Effect 1, when leaving Kaidan or Ashley behind one of dialog options is "Fight hard, die proud".
Mass Effect 2 has an assassin named Thane Krios who, upon finding out that his days are numbered, goes on a personal quest to kill some of the more prominent crime lords in the galaxy before dying. He joins Shepard's team after his last job for the same reason.
The game pretty much opens with explaining that Snake's body is failing and that he will most likely die within months. While often near the point of giving up, he gets a grip on himself and gives everything to stop Liquid Ocelot.
And then there's the entire final act of the game, and also the entire series. There's really not much the recruits on the Missouri can do against Outer Haven, but with only a few hours left before Ocelot's rule over the world becomes perfect and being the last military unit not under his complete control, Mei Ling leads them into a full out attack anyway.
In a way Big Boss and Zero also count, as their entire lives works were based on their anger about soldiers being considered disposable and they would not have that.
The ending of the prequel game Halo: Reach was a forgone conclusion, given that the Fall of Reach was a major plot point in the game universe's storyline, and Master Chief is explicitly known as the Last Spartan. Nonetheless, the final level of the game shows that the second-to-last Spartan definitely Did Not Go Gently.
The Blood Ravens after delivering the poison to the hive fleet, but getting their extraction ship shot down and leaving them stranded behind Tyranid lines, and again when (if) the Tyranids win the Retribution campaign.
The Multiplayer game Zombie Overrun in Red Dead Redemption is Do Not Go Gentle The Game! You are told that you are going to die and instructed to take as many Zombies as you can with you.
In Marathon 2, Durandal is at one point cornered above a planet with his single corvette, and an entire Phfor fleet bearing down on him. Even with the upgrades he's made to the ship, he knows he can't win. He fights regardless, and takes half the Phfor fleet down with him.
In Defiance, in an Offscreen Moment of Awesome, Vorador is captured by Moebius and his mercenary army, but not without "a considerable price in blood."
A non-lethal variation would be the ending of Little Mac's career in the Wii remake of Punch-Out!!, in which in the post-Title Defense matches, Little Mac resigns after three losses. See the Fridge page of Punch-Out!! for more details.
Super Dangan Ronpa 2 subverts this with the execution of Pekoyama, who tries to go down swinging against an army of Monobears until she accidentally injures and almost kills Kuzuryuu, her childhood friend/superior, who rushed in to try and save her, allowing the Monobear army to finish her off while she's having a "My God, What Have I Done?" moment.
Assassin's Creed IV: Black Flag has the mission "Do Not Go Gently..." in which Blackbeard and company are ambushed by the British and he dies fighting them off.
Red vs. Blue has this in Episode 18 of Revelation. Sarge gives this, surprisingly, stating that even though they have no chance of surviving (according to Simmons), they should go out and fight anyway. And the most surprising part is that even the coward Grif does just that.
The protagonists of Sevenshot Kid know that they aren't ready or capable of dealing with a tall, dark stranger but they know they're the only ones that can possibly hope to improve their situation.
Mat-Ti in Suburban Knights is driven to one of these after being sent on one too many snipe hunts by the Channel Awesome crew. He goes right up to the Big Bad Malecite's face and declares he's going to fight even though he knows he's totally screwed. Fortunately, his "Heart" ring is actually Aeon's Ring, the one thing that can stop Malecite, and Mat-Ti defeats him. Unfortunately, Mat-Ti still dies in the process.
In Worm, the Undersiders decide to do this after failing to stop the end of the world. They talk over their priorities a little first.
Canary: This is us? We're whiling away the time until the world ends? Giving up like everyone else? Tattletale: What? No. Fuck no. Imp: No. Wait, did anyone think that? Because I was thinking this was more us trying to decide what the hell we need to do before we throw ourselves into one final, suicidally reckless attack. Taylor: Basically. Minus the suicidally reckless part. There's other stuff we can try first. But yeah. I think we're mostly on the same page here. Bitch: Go out fighting. Tattletale: Go out fighting. Taylor: Nothing held back. Right. I'll need my stuff.
The final stand of Dinobot in the Beast Wars series episode "Code of Hero". After momentarily reflecting on his decision to fight, he singlehandedly defeats all the Predacons, who were destroying a valley where the first humans were living, and with the last of his strength destroyed the Golden Disk, ruining Megatron's plans.
He even fights Megatron with a rock on a stick and makes it look good.
Megatron: What could you possibly do? (aims his tail gun at Dinobot)
Dinobot: Improvise! (whacks stick onto a rock, smashes his new-formed stone hammer into Megatron, grabs the Golden Disc, and obliterates it with an eye-laser that takes the last out of him)
His replacement Depth Charge does something similar during his final battle with Rampage.
Gavrilo Princip personally accepted the mission to assassinate Archduke Franz Ferdinand because he was dying of tuberculosis and wanted to do something significant while he was still alive. By all accounts, he succeeded at his goal.