Puella Magi Madoka Magica: Homura has witnessed her best friend dying or corrupting four times or more and failed to stop it from happening three times or more. She's watched her fellow magical girls kill each other out of despair. She was present for the end of the world. Kyubey's system of Miracle Contracts is, by her own admission, inescapable. Yet despite all of this, she's determined to find the Golden Path that leads to Walpurgisnacht's defeated without Madoka's Heroic Sacrifice.
Madoka sums it up beautifully as she makes her wish (becoming hope itself in the process):
"If someone says it's wrong to hope, I'll tell them they're wrong every time. I could tell them that countless times!
In The Sandman: Preludes and Nocturnes, Dream goes to Hell to retrieve his helmet. The demon Chonoronzon, who currently possesses it, challenges Dream to the ultimate game of "Can you top this?" Choronzon's final move was becoming entropy personified. Dream responded, and won, by becoming Hope.
This is the schtick of the Blue Lantern Corps. It's comprised of hand-selected individuals who have the ability to inspire great hope. Their unofficial leader, Saint Walker, was considered a savior by his people and was the first Blue Lantern. The way their rings work also acknowledges the limitations of hope: their rings can perform amazing feats while they are supporting Green Lanterns but are almost powerless on their own, since hope without the willpower to change things is meaningless.
There is a certain Star Wars Tales story set in the far, far future of the galaxy. C-3PO has told a young boy named Remoh the story of the films. The story ends with him destroyed, and Remoh taking up Luke Skywalker's lightsaber, ready to stand against the new Empire.
All Fall Down has this as a theme of the book: Even in the face of great tragedy, there's potential for things to improve.
During Final Crisis, Superman travels through the Multiverse. One Earth he glimpses is a post-apocalyptic wasteland based on the old Atomic Knights comic-book. Superman describes it as "alive with radioactivity and hope".
In The Abundance, the chapter begins with a quote from The Lord of the Rings saying there is no hope and things look that way: Twilight has been taken down by Loyalty, Scootaloo is dead, and Faith has gone missing after being mortally wounded. To twist the knife, Loyalty captures The Doctor and Dinky Hooves and sends them plummeting to their deaths. It is then that Derpy Hooves, who spent the entire story catatonic due to her daughter being taken, performs a freaking Sonic Rainboom, showering Cloudsdale in light. Twilight breaks free, Scootaloo's heart starts back up, and Faith, seeing the Rainboom, turns the massive airship he stole towards Cloudsdale. The chapter ends with another LOTR's quote: Hope... is kindled.
In the Homestuck AU Loophole, the climax occurs with Vriska, the young troll in John's care and his de facto daughter, being put down. In spite of everything he and his allies could do, they couldn't stop this. And what's worse, it turns out she was already dying of liver failure, twisting the knife in further. Naturally, John retreats into mourning, barely able to get out of bed even with the help of his immediate family. But there are two sparks of hope in such crushing despair. First, that the injustice of Vriska's death was felt by a swarm of people, who turn out for her funeral (a fact that also hints of potential for pro-troll social change). And second, because even though Vriska is dead, John's family and friends are around, as are a collection of other young rescued trolls. They need him, and in turn teach him life goes on. The Epilogue shows John having continued that work, able to move forward in spite of his crushing loss.
At the end of the Star Wars prequels, the Emperor has taken power, Anakin Skywalker has fallen to evil, the Jedi order is destroyed, Yoda and Obi-Wan have been driven into exile, and the Republic has been turned into the oppressive Galactic Empire. But The Alliance has begun to form and the Skywalker twins have been hidden from their father, Darth Vader, and they both will become a new hope.
Independence Day. Most of the major cities on Planet Earth have been wiped out, and all attempts at attacking the aliens have failed so far. But there are still planes, and pilots to fly them. And besides, it's the Fourth of July!
The tagline for Deep Impact was "Oceans rise. Cities fall. Hope survives." It fits that movie well, by the way.
Hope is what sustains Andy Dufrense after his false-conviction and incarceration in The Shawshank Redemption. He and Red even get into an argument over having Hope in prison, with Andy saying it is necessary and Red saying that it is dangerous. Eventually, Red comes to Andy's point of view.
"Remember, Red? Hope is a good thing, maybe the best of things, and no good thing ever dies."
Gilraen, the narrator of the story in Born of Hope, addresses Baby Aragorn as Estel, which means Hope in Sindarin.
In fact, this trope is just about the entire message of the movie.
In Finding Nemo, after they have escaped from a hungry shark and massive minefield explosions, Marlin and Dory are exhausted. Marlin is anxious to find his missing son, Nemo, but now he has lost his best clue for finding him — a scuba mask inscribed with the address of the diver who captured Nemo. Dory helps Marlin find hope. Discouraged, Marlin says, "That was my only chance at finding my son; now it's gone!" But Dory is not so easily deterred. "Hey, Mr. Grumpy Gills," she says. "When life gets you down, you know what you gotta do? Just keep swimming, just keep swimming, just keep swimming, swimming, swimming. What do we do? We swim, swim."
Transformers: The Movie uses this. The majority of the film features the Autobots getting their asses kicked across the galaxy. At the very end, they unite to make a last ditch effort to destroy Unicron and Light Their Darkest Hour.
President Snow Lampshades this trope during his conversation with Seneca Crane in film version of The Hunger Games. He says that the Games have a winner precisely so they can invoke this trope and create a false sense of hope for the Districts. He also tells Seneca that he doesn't like underdogs (like Katniss) because they create a real sense of hope, thus playing this trope straight.
Star Trek II: Wrath of Kahn gives us James T. Kirk's undying credo, "I don't believe in the no-win scenario."
Subverted in The Dark Knight Rises. It is the hope that they can escape, but the reality that it is nearly impossible that drives most of the prisoners in Bane's old jail insane. Bruce realizes that he has to risk everything by not using a safety line (which was dragging him enough to miss one of the jumps) to get out of the pit.
The Trope Namer is Alexander Pope's ''An Essay on Man, Epistle I, 1733:
Hope springs eternal in the human breast;
Man never Is, but always To be blest:
The soul, uneasy and confin'd from home,
Rests and expatiates in a life to come.
The poem Hope Is A Tattered Flag is about this:
The birds who go on singing to their mates in peace, war, peace,
The ten-cent crocus bulb blooming in a used-car salesroom,
The horseshoe over the door, the luckpiece in the pocket,
The kiss and the comforting laugh and resolveâ??
Hope is an echo, hope ties itself yonder, yonder.
In the Tanith Lee story "Red As Blood," one of the characters claims that Hope is the greatest evil released from Pandora's Box, because it gives people false comfort in time of troubles.
As noted above, Stephen King's "Rita Hayworth and the Shawshank Redemption". Even carries the additional title "Hope Springs Eternal".
The Lord of the Rings and The Silmarillion. There are quite a few irredeemably evil entities attempting to oppress every other living entity, and most of them succeed for some period of time; so there's always a host of brave and wise elves, or outnumbered but courageous humans, or tough-as-nails dwarves, or determined hobbits, or powerful wizards, or even incredibly powerful godlike entities from across the sea preparing to come save the day. A few characters make speeches on hope (notably Sam to Frodo) which get everyone else back on their feet.
Emily Dickinson wrote a poem about this:
"Hope" is the thing with feathers—
That perches in the soul—
And sings the tune without the words—
And never stops—at all—
And sweetest—in the Gale—is heard—
And sore must be the storm—
That could abash the little Bird
That kept so many warm—
I've heard it in the chillest land—
And on the strangest Sea—
Yet, never, in Extremity,
It asked a crumb—of Me.
The end of Matt Stover's novelization of Revenge of the Sith notes that this is the Dark Side's weakness. Darkness is all-encompassing, powerful, and will never vanish...but a single candle can hold it back. Crosses over with The Power of Love as well.
Love is more than a candle. Love can ignite the stars.
Parodied in Going Postal, where the cynical Boxed Crook protagonist thinks of hope as the thing that makes people fall for "get-rich-quick" schemes and other cons.
In The Pillars of the Earth however the villains try to stop the construction of the cathedral, they fail. Even burning the whole town down doesn't help. There is one point in the story when Philip gives up all hope, but it only lasts until Jack returns from France and decides to build the cathedral in Gothic style.
G.K. Chesterson famously wrote, "Fairy tales are more than true: not because they tell us that dragons exist, but because they tell us that dragons can be beaten."
Peeta represents this to Katniss in The Hunger Games, having been the first person to give her hope after her father died.
Live Action TV
Invoked in an episode of Star Trek: Deep Space Nine where a group of genetically-enhanced super-geniuses calculate that the Federation cannot win its war against the Dominion. They argue that the Federation should surrender, accept an occupation and humanity will form La Résistance a few generations later, centering on Earth itself.
The irony being that a scene earlier in the series, set in the Dominion HQ, shows that their leadership is Genre Savvy enough that they plan to simply wipe out every living thing on Earth as a preemptive measure to any kind of human resistance down the line.
Bob Dylan's To Make You Feel My Love is sung from the point of view of a man who is in love with a woman whose life has treated her harshly, and who has especially had bad luck when it comes to romantic relationships. The lyrics gently tell her to never give up hope, because there's still someone who loves her:
The storms are raging on a rolling sea
Down the highway of regret
The winds of change are blowing wild and free
But you ain't seen nothing like me yet
Garth Brooks' The Change is about doing the right thing, and never giving up. Ever. Or else evil, sadness, and hatred win.
Die liebe Erde allüberall blüht auf im Lenz und grünt auf's neu! Allüberall und ewig blauen licht die Fernen! Ewig... Ewig...* Everywhere the dear earth blossoms forth in spring and grows green again! Everywhere and forever, distant horizons gleam blue: forever... forever...
The message of the The All-American Rejects song "Move Along" is to never give up and never give in, because it gets better. All you have to do is keep going, no matter how hard it is to do so.
When all you got to keep is strong
Move along, move along like I know you do
And even when your hope is gone
Move along, move along just to make it through
Jimmy Buffett's "Breathe In, Breathe Out, Move On" is a Tear Jerker tribute to New Orleans and what it endured during Hurricane Katrina, but the constant message of the song is that in the end, there is always hope.
If a hurricane doesn't leave you dead
It will make you strong
Don't try to explain it. Just nod your head
Breathe in, breathe out, move on
Pandora's Box not only unleashed evil upon the world, it unleashed hope.
One of the many different versions of the story: Hope was at the bottom of the box, so when a panicky Pandora snapped it closed again, Hope was the one thing left inside. Thus while all the evils of the box are beyond man's control, we still have Hope kept safe for when we need it.
More cynical interpretations view it differently: we have all these evils in the world, but not hope.
In other versions, the thing left inside the box was the ability to foresee misfortune (the opposite of hope, in other words) or else that hope would have been a terrible evil had it been released, but a force for good since it remains inside.
And in still other versions/interpretations, it was not hope, but rather hopelessness that was trapped inside the box. Arguably, this makes more sense; hope still exists in the world because the evil of its lack was the one thing that didn't escape into the world.
At least, hope without the willpower to change things is meaningless, as in  where the Blue Lanterns are nearly useless without a Green Lantern around.
In at least some versions of Norse Mythology, Ragnarök ends with the death of the Gods, the destruction of Ásgarðr, and the reduction of Miðgarðr (the mortal world) to a barren wasteland. But one mortal couple survives to repopulate the world.
Also Baldr comes back form the dead. And a handful of young gods also survive to help him.
And now for a depressing example: Tzeentch is the evil God of Hope in Warhammer Fantasy and Warhammer 40,000. He can't be killed (and killing all his worshippers is less than practical), so technically, hope goes on forever.
The reason that Tzeentch can't be killed is because he is the God of Hope. Taken to an insane extreme, like all the Chaos Gods. The very thing that allows mortals to fight him and his forces IS him.
Here's something to help counterbalanace that: Tzeentch may be the ultimate manipulator, but you can take heart in one thing. He has no plans. All of his twists and turns, plots and schemes... they're all for their own sake. If Tzeentch ever had an actual goal that was accomplished, he'd probably cease to exist. Hope for the future, because Tzeentch can't.
All of Warhammer 40k is a depressing example, but the Dark Heresy tabletop game places one single bright point within it. You are a human in the Imperium of Man. You live in a shitsack world setting so bleak that it is (in)arguably the crappiest of Crapsack World settings. Every side is evil, typically horrifyingly so, and the Imperium certainly counts. There is no real way to defeat Chaos or even the mundane enemies of the Imperium, not for good. The collapse of humanity into ruin, chaos, death and worse is only a matter of time. You play an Inquisitor. Your job? To hold off that collapse, and preserve the souls and lives of humanity. For one more year, one more month, one more day. One more hour. Your name will not be remembered when you fall. You will not know glory in life, or rest, or peace. But you may succeed in preserving your species for just that little bit longer. Grow powerful enough, you may even succeed in making things better for some small fraction of humanity. In all the horror and constant, borderline self-parodying grim dark that is Warhammer40k, no other philosophy shines so bright as this. One single light in the dark.
Done very literally in the end to the video game Mother 2.
The Fallout series. Sure, America, if not the world, is a post-apocalyptic wasteland full of radiation, disease and angry mutants that want to paint their walls in your brain splatters, but settlements are building and civilization is returning. The NCR, New Arroyo, Megaton, Rivet City for example. The DC wasteland has clean water, and Project Purity can be replicated (however the rest of America doesn't seem to really need it). And, hidden by those grimy orangey-grey clouds, is still a bright blue or starry sky.
Pandora in God of War 3 is a big believer of this. In the end, she even manages to get Kratos to agree with her.
Pandora: Hope is what makes us strong! It is why we are here. It is what we fight with when all else is lost.
Taken to a literal extreme in the end. Amongst the evils in Pandora's Box was Hope. It was inside Kratos ever since he used the box to fight Ares in the first game. Once Kratos' rampage is over, the world is pretty much destroyed (both literally and figuratively) by the deaths of the Olympians. Athena, the last surviving god, tries to take Hope from Kratos, using it to rule what's left of the world. Instead, Kratos kills himself, releasing the power of Hope to every mortal. The last shot of the game is the sky clearing, implying the world will finally begin to recover.
At the very end of the Legacy of Kain series Defiance, Kain muses that hope was the true gift Raziel bestowed upon him. Being a cynic, he refers to it as "the first, bitter, taste of that terrible illusion" but one he can't help but believe.
Final Fantasy VI features something along these lines. Kefka obtains godlike power, the world is ruined and the remains crushed under his iron rule. The heroes, scattered by the cataclysm, struggle to survive, eventually reuniting and rising to challenge Kefka again even though the situation seems hopeless.
In the "Hope" trailer for Star Wars: The Old Republic, Jace Malcolm says it only takes a single spark of courage to ignite the fires of hope and bring peace to the galaxy.
At the end of Wild ARMs 3, while the heroes have defeated all the threats to Filgaia, the world is still a Death World with oceans of sand, and the heroes are believed to be responsible for the death of the leader of the world's main religious order. Nonetheless, at the end of the ending sequence, the camera focuses on a single flower that has taken root, with the hope that this flower can bloom and prosper.
In the Codename: Kids Next Door movie Operation: Z.E.R.O., Grandfather's first rule over the Earth was brought to a screeching halt when the Book of KND gave the kids the hope needed to defeat him. When he returns, he's become Genre Savvy to this and knows if he doesn't completely destroy all hope, he can still be defeated.
Every participant of any ideologically-motivated resistance movement against an occupying power feels this at times, or even constantly (or to the bitter end). Even when almost all hope seems lost, people will remember - or imagine - what it would be like to live a society in accordance with their ideology and draw strength from that vision. Humanity's capacity to imagine is very great indeed. The only way to make such ideals go away is to give them what they want - whereupon after a time they become disillusioned with the new or 'restored' society and eventually move on to believing something else is worth fighting, or dying, for. Such is life.