This can happen on game shows: a contestant struggles throughout the main game, but still manages to win anyway and does even better in the Bonus Round. A good example is a 2003 episode of Wheel of Fortune where a rough main game led to first place having only $5,500 but she won $100,000 in the Bonus Round.
There is a suspicion that in the old days of Lord Reith as Director-General, the BBC felt compelled to meet its mission statement of seeking to educate the viewing British public, whether the British public wanted to be educated or not. Thus, in The '70s, British youth avidly and impatiently waiting for its weekly fix of exciting live bands on Top of the Pops at seven-thirty on a Thursday evening had first got to sit through the worthy, earnest, and often rather dull science and technology magazine show Tomorrow's World, which began at seven. It was the TV equivalent of "you can't have your pudding until you've eaten up all your greens".
On Alias, Sydney leaves the spy world behind and finds peace in Santa Barbara.
The central plot of Angel was the titular character Angel "helping the helpless" to make up for the evil he had done in the past, after discovering that an ancient prophecy stated that a "vampire with a soul" would become human again by playing a part in one of the upcoming apocalypses. The entire series is Angel earning his happy ending. Ultimately subverted by the end of the series, when he must give up his chance of ever becoming human in order to defeat the Circle of the Black Thorn. The show's central theme near its ending was that a lot of the time there is no happy ending to earn - but that doesn't mean we should stop fighting for it.
Ashes of Love: It takes them five hundred years and reincarnating, but Jin Mi and Xu Feng finally get to live happily ever after with their son.
Babylon 5: Five years of war, a change in commanding officers Both who sacrifice themselves, Sinclair becoming Valen, Sheridan getting the 20-year curse and a civil war to give birth to the Interstellar Alliance and end the machinations of the First Ones. And oh yeah, Sheridan and Delenn happy for 19 years, anyway.
At least, they decide to make the best of it. The ISA, despite its teething troubles, flourishes first under Sheridan, then under Delenn.
Several of the most important characters earn theirs in the end as well. Ivanova goes through hell herself, endures a couple of decades ground down as "an old war horse" before the Grand Finale, when Delenn chooses her to lead the Rangers. As post-series canon notes, she devotes the rest of her life to the organization, and it too gains tremendous respect and prestige, and she is honored as highly as Sheridan and Delenn for her contribution to society, an ending she could at least appreciate.
Although Ivanova could be a subversion as well. Despite this prestige and her military success, she still struggles with emotional relationships and is implied never to have recovered from Marcus's (and her other loved ones) deaths.
Garibaldi spends most of the series as a jaded Knight in Sour Armor and recovering alcoholic who believes he'll wind up shot in the back in a dark corner of the station. (He has reason to it actually happens to him, but he survives.) He rides the roller-coaster of helping to secure the ISA, falls Off the Wagon a couple of times, but finally reunites with his lost love, marries, and becomes a corporate tycoon, his unusual ways actually giving the company excellent standing. Literary canon reveals he even manages to get some long-sought payback for getting Mind Raped by Bester back in 2261. And unlike his cynical prediction, the last years of his life (according to Word of God) are actually very quiet and uneventful, as if the universe finally decides to give him a break.
G'Kar submitted himself to sadistictorture, extreme humiliation, and the very real threat of death by vivisection, all at the hands of Emperor Cartagia, all as part of a plot by him and Londo to overthrow Cartagia before he gets Centauri Prime destroyed, and for G'Kar's part, a promise to press for the liberation of the Narn homeworld once the grownups are back in charge of the Centauri government—and Londo does keep his word, and as the new Prime Minister persuades the Centauri to leave Narn.
Helen Stewart and Nikki Wade on Bad Girls. It takes three years of torment, unrequited love, Paolos, denied appeals, breakups, makeups, and tears before those two get their happy ending.
By the end of Bangkok Hilton, Kat has made a connection with her father, escaped her execution for drug trafficking charges, returned to Australia (where she will be safe from extradition), and successfully apprehended the smuggler who set her up. It does fall into Bittersweet Ending, though, as her friends Mandy and Billy Engels were executed shortly before her trial.
Blackadder: Back And Forth was a long-awaited Happy Ending for the Blackadder series. After four seasons, over five hundred years of trying to take over England, or at least trying not to die, (a) Blackadder finally controls England, openly, with a hot wife and a puppet Prime Minister, and is universally loved.
Even better, the narration implies that Britain is once again a hyperpower, which means Blackadder controls not just England, not just the United Kingdom, but the entire world. Mwahahahahahaha!
Blackadder III could qualify, if you weren't too attached to Prince George...
Dr Turner and Sister Bernadette on Call the Midwife. Dear God. After months of heartache, a bout of tuberculosis and the agony of love that couldn't be spoken as Bernadette was torn between her vows to God and the man she loved, all was said and settled in about sixty seconds on the side of a foggy English country road. She said yes before she even knew his first name.
By the end of season four, the sisters have lost one of their own, but in the process defeated the Triad far earlier than they were supposed to. The Angel of Destiny offers them a life without magic as reward, but they refuse. In season eight, Leo was supposed to have been killed, and the grief would spur them to fight much like the loss of Prue did. Piper, however, convinced the Angel of Destiny to only temporarily take away Leo, who was eventually returned to them. This time the Triad, among others, were Killed Off for Real.
Piper and Leo's entire relationship has been filled with so many trials and tribulations of both the romantic and the magical kind, they're the epitome of this trope for Charmed.
Community: Parodied and Deconstructed with Abed's story in "Horror Fiction In Seven Spooky Steps": from what he says after he finishes telling it (a story in which a couple completely and utterly defy every single slasher film victim trope), he seems to think that "earning" it would be the characters following a number of logical steps to not get killed by the book. Annie fires back disgust at not seeing the characters actually having any obstacles to fight off to go along with the logical decisions (seriously, after so much set-up that there is a Serial Killer on the loose nearby, the couple does not even encounters him), and thus the audience is bored.
Annie: Ugh! Do these people ever die or what?!
Abed: ['Spooky' voice] Eventually... once it had been... earrrrrrrrned!
[Everybody else in the room immediately starts looking for something else to talk about]
Most (but not all) Dead Man's Gun episodes where the gun has a more sympathetic (although often poor and/or unhappy) wielder have the gun putting that person through danger and/or imparting a powerful lesson but leaving them off in better circumstances than the start of the episode, such as "The Imposter", "The Gambler" "Four of a Kind" "Bad Boys" "The Bounty Hunter", "Sisters of Mercy", "Winner Takes All" and "The Pinkerton."
Especially true of the two-parter "The Empty Child"/"The Doctor Dances"; after all the loss and suffering he had seen in his life, not to mention the fall of the Time Lords during the Great Time War, for once the Doctor was able to achieve a complete victory against death. "Everybody lives, Rose! Just this once, EVERYBODY LIVES!"
"The End of Time": The Doctor invokes this trope by visiting many of his past companions before he regenerates. Bidding them all final, and indeed personalised, farewells is his reward; he even gets to see (Martha and Mickey) or cause (Jack, especially Donna, and even Rose) theirs. Heck, even Jackie gets an implied one, if you recall that, yes, she eventually did do better.
This seems to happen in "The Day of the Doctor". He's managed to Retcon his greatest regret, the destruction of Gallifrey, and now sets out to find it. Then again, see the next entry for how that turned out.
The Twelfth Doctor's parting with his beloved companion Clara is just as unusual as the waythey met each other, but ultimately qualifies as a hopeful Bittersweet Ending for both of them. It unfolds over three episodes, starting in "Face the Raven", when Clara dies by accident in a semi-willing heroic sacrifice for her pal Rigsy, leaving the Doctor devastated and in a vengeful mood just as he's being delivered into the hands of enemies. "Heaven Sent" sees the Doctor fighting his way out of a bespoke torture chamber over billions of years. The happy ending is in sight as "Hell Bent" begins! He returns to his homeworld, and manages to have a living copy of her extracted from her timeline just a moment before her death. He defies his people and tries to run away with her, and convince her to erase her memories of him and return to Earth as a theoretically immortal human... BUT Clara's having none of it. She disagrees with cheating her own death and is too fond of her memories to be manipulated and this whole business might destroy the universe in the bargain. The Doctor relents and his emotional memories of her end up erased instead, so both of them can move on. Clara meets and converses with him later, though he doesn't recognise her by appearance, and she decides to go adventuring in the other stolen TARDIS, keeping in mind the Doctor's best principles and the fact she'll have to revisit her death someday. The Doctor moves on as well, vaguely remembering Clara, but oblivious he now has a TARDIS-flying ally (and apprentice of sorts) out in the universe. So this trope is subverted for the Doctor but not a total downer and played straight for Clara who wouldn't have had this ending without the Doctor's actions.
Those who feel that the above ending was a little hard on the Doctor will be happy to know he and River Song play this trope straight in the very next episode, "The Husbands of River Song". After almost 200 years of pining for her sweetie on her part, and everything he's gone through of late with Clara on his, they arrive at what he knows is the place they will spend their last night together. But not only does he make this night as wonderful as possible for her and prepare the means for his tenth self to save her in the library it turns out that a night on Darillium lasts twenty-four years. With that, the episode ends on the title card "And they both lived happily ever after".
"The Doctor Falls", the Series 10 finale, has this for Bill Potts, who in the previous episode "World Enough and Time" was mortally wounded, forced to wait in hospital for the Doctor for ten years (while only minutes passed for him), and just as he was arriving Cyber-converted by a false friend who did this solely to torment him. Traditionally this dooms someone to a Mercy Kill, Heroic Sacrifice, or suicide, and there's nothing the Doctor can do to help under the circumstances. Nonetheless, the poor soul stands with him in a final battle against other Cybermen. As she weeps over his seemingly dead body her long-lost sweetheart Heather, "The Pilot" of the season premiere, returns and turns Bill into a fellow time-and-space-travelling shapeshifter with her refined/expanded powers. After leaving the Doctor's body in the TARDIS, Bill and Heather explore the universe together. The only down point of this ending is that she may never know that he lived, as she hoped.
Downplayed for the Twelfth Doctor at the end of his Myth Arc. He wants to die for good instead of regenerating at the end of "The Doctor Falls", having lost everyone important to him and believing he failed in his quest to redeem Missy, but then he encounters his original self, who also didn't want to regenerate. The Grand Finale that follows ("Twice Upon a Time") has a crisis but it's all a misunderstanding, he manages to convince the First Doctor that he should embrace his future by looking to the good he can do and not the suffering that will come with it, he learns that Bill got a happy ending after all, and finally he has his memories of Clara restored as a gift from the antagonist that isn't. From there, though he remains alone and longs for a final rest, he decides that helping others is Worth Living For and regenerates with a peaceful, accepting heart into Thirteen.
There was much tragedy in Downton Abbey, but no one had it rougher than Edith, who endured a childhood of being The Un-Favorite, got stood up at the altar, and got pregnant out of wedlock while her boyfriend goes missing for a year before being found murdered. However, at the end of the show, she was finally married to a wonderful man and even wound up with a title that made her outrank her entire family.
Friends: Monica and Chandler. Both had difficult childhoods, Monica was The Un-Favourite and Chandler underwent Parental Neglect, leaving them emotionally damaged. Together they overcame their personal insecurities, and despite their early marriage being fraught with unemployment and infertility they continue to support each other and eventually adopt children and get the family they always wanted. They also provide a much-needed contrast to the tumultuous Ross and Rachel showing a couple who actually work at their relationship and make each other stronger. They end the series blissfully happy, very much in love and boy, have they earned it.
Also Phoebe who grew up on the streets but eventually found the Friends and a normal life.
For Ross, too, who, after three divorces and years spent as the resident Butt-Monkey, is finally in a relationship that will last.
One of these divorces was with the woman he ultimately ends up with anyway, though. Still the Butt-Monkey.
So far, Hot Pie is the only character to exit the story in a content, non-violent manner by becoming a baker in a quiet wayside inn. It's actually quite touching.
As of the season finale, arguably the case of the surviving Stark children. Bran lost the use of his legs and part of his humanity to become the Three-Eyed Raven, but he is chosen to be the king of Westeros after Daenerys' death. Sansa was held prisoner for years, raped and manipulated and humiliated, but she is queen of an independent North. Arya always wanted to fight and to see the world, and she can as a trained assassin and also be the first person to sail west of Westeros. And Jon, the bastard son who always felt more at home among the Wildlings, rejoins them and is a dead cert to be the new King-Beyond-The-Wall. In short, despite all the death and all the hardship, House Stark won the Game of Thrones.
Throughout the run of Good Times, the Evanses have seen just about every attempt to make a better life for themselves and get out of the projects end in utter disappointment. At the end of the series, Keith's leg gets better and he signs a contract with the Chicago Bears, allowing him and Thelma (who's pregnant) to buy an apartment in a swanky building and they invite Florida to live with them. Willona is promoted to head buyer at The Boutique and is also able to buy an apartment in the same building for herself and Penny, making them neighbors. JJ designs a new comic book character and is picked up by a publisher, who gives him an advance large enough for him to move out on his own. With everyone else financially secure, Michael decides to move into a dorm on campus. After five and a half seasons of struggling to make it, the family has definitely lived up to this trope!
This is how most of the episodes of House turn out, although occasionally, the writers throw in a Downer Ending. Sometimes, they leave it up to the audience to sort out whether it's a case of Downer Ending, Bitter Sweet Ending (when the patient's life has been ruined in the course of saving it, usually as some secret has been exposed) or Earn Your Happy Ending.
Part of the reason How I Met Your Mother is able to get away with so much misery and misfortune and such serious fights is because it is backstory: Future Ted confirms that everything turns out fine in the end. Ted meets his wife, Lily and Marshall stay married, Robin is very close to Ted's kids, and Barney was finally seen to be alive at least until the year 2021 (The Exploding Meatball Sub). Also, by the way Ted talks about them in 2030, the group is still close enough to be referred to as "aunt" and "uncle" to Ted's kids and usually referred to in the present tense.
Arguably hurt by the final episode, in which: the mother dies, Barney and Robin break up after the entire final season was about their wedding. It ends with Ted standing outside Robin's window with the Blue French Horn.
iZombie: The Zombie Cure is shown to work, thus the Zombie Epidemic is cutoff at the seams. 10 years later Peyton and Ravi are still together, living in Atlanta. Clive and Dale are still Happily Married, with children, Jacob and Olivia. Liv and Major are revealed to have survived their "deaths", and the two found their way back to each other, disappearing off the grid and raising Liv's orphans in a secluded haven called "Zombie Island". Given that they are Undead, the two will be together for the rest of eternity, which Peyton and Ravi consider joining.
Kamen Rider Build starts with Japan being split into three by an alien artifact and the three regions on the brink of civil war, with both a terrorist group and a war profiteer willing to light the powderkeg. War does indeed break out and the heroes are devastated by the horrors of war as well as the fact that they, as Unwitting Pawns, helped make the war possible. Then it's revealed that the alien artifact is a superweapon capable of destroying entire planets, and its owner is an alien who's used it to destroy countless civilizations, is planning to do so to Earth, and is far more powerful than everyone else, dealing the heroes defeat after defeat as he gets closer to fulfilling his plans. And all the while, countless innocents are caught in the crossfire as the heroes desperately try, and fail, to bring the fighting to an end. Eventually though, after much struggle, Sento manages to undo everything that the Big Bad did by erasing him from existence, and creates a new world where none of the horrible atrocities he committed ever happened. Everyone, even people who died during the series, is shown alive and living happy lives, and while Sento and Ryuga, anomalies of the new world due to the fact that their existences were so tied to all the things the Big Bad did, are left as the only people who remember what happened, they at least still have each other for company and the series ends with the two of them setting out to find a new place for them in the new world, bickering the entire way. Thankfully, they achieve their true Golden Ending in the movies, where all their friends regain their memories and they finally grow accustomed to their new lives.
In the Flemish TV series Kulderzipken, the eponymous Kulderzipken (a simple farmboy) has to overcome many obstacles, not least of which the disapproval of the King. In the end, though, he and princess Prieel do get married.
The Mentalist: Jane joined the CBI with only the idea of finding and killing Red John in his head, after losing his wife and daughter. Several years later, he has made many friends, his life is stable, he has found Red John, and he is not only married to Teresa Lisbon, but she is also pregnant.
Arthur and Guinevere's relationship in Merlin. To start off, it's forbidden, and so Arthur denies his feelings for all of Series 2. In Series 3, he still won't say it, but the feelings are definitely there. They finally go on a date, only for Morgana to lead the king to it. Arthur admits his feelings, and Gwen gets banished. Arthur decides to leave Camelot, and Morgana has Gwen accused of witchcraft and nearly burned at the stake. In Series 4, they can finally be together publicly. Lancelot even sacrifices his life for Arthur's to avert the Love Triangle. Then Morgana raises Lancelot from the dead and enchants Guinevere into regaining her old feelings for him. Arthur witnesses the kissing and tries to Murder the Hypotenuse, leading Gwen to step in and seemingly confirm her feelings. She's banished from Camelot on pain of death. In the finale, he realizes he can't live without her and marries her. They managed to survive the Arthurian Love Triangle and are Happily Married...but the writers put them through hell to pay for it.
The ending is up to the audience to decide whether it's this or a downer ending, with Camelot likely going to enter a new age of prosperity, a united kingdom and the world generally being better off. Of course, Arthur is dead, Gwen widowed, many fan favourites dead and Merlin seemingly left traipsing the county for over a thousand years.
Regardless of the overall series, it's played straight for the magical people. After spending nearly thirty years living in hiding, Gwen and Merlin break the Cycle of Revenge that kept the two peoples from reconciling.
Kelly in Misfits is noteworthy as the only one of the original five leads to get a proper happy ending. Nathan ends up in jail in Las Vegas after using his powers to beat the house at a casino and getting caught in the act; Simon and Alisha are trapped forever chasing each other through a time loop in which they are forced to endure one another's deaths, over and over again, possibly forever, as the price of being together; and Curtis commits suicide when he realises his power of resurrection will result in a Zombie Apocalypse if it goes unchecked. But for Kelly - though she endures at least as much as the other four during the actual series - there's a happier endnote: she and her Love Interest Seth work things out, and she's using her powers to defuse mines and save children in Africa.
Nashville: Here's some of what Juliette Barnes through during its three-season run - she had a drug-addicted mother who pimped her out to adult men when she was a child; her remorseful mother trying to clean up her act ... but her counselor Dante slept with Juliette, eyeing control over Juliette's career (and money), blackmailing her with a sex tape... Then her guilt-stricken mother kills Dante, and then herself. And then she gets into a potentially career-ending scandal over a manipulated clip... and then there's her incredibly troubled pregnancy... her being the sole survivor when her plane crashes... her indoctrination into a cult and being held in against her will in Bolivia by said cult. The series ends with a pregnant Juliette living peacefully on a farm just outside Tennessee with daughter Cadence, having retired from country music, and about to reunite with her husband Avery. Well, just about all the remaining regulars get a happy ending in the Series Finale, but Juliette's is particularly well-earned.
NYPD Blue: Andy Sipowicz went through one murdered wife, one murdered son, two dead partners (and a third quitting in disgrace), and two cancer scares (His own and his toddler son's), all while trying to clean up his act after spending much of his career being an alcoholic Rabid Cop. He ends the show's run as squad commander, with a beautiful wife and newborn daughter at home.
Only Fools and Horses: The Trotters started out from day one wishing to become millionaires one day. They did - twice.
Happy Ending One was in "Time On Our Hands" (which was originally the series finale). Del and Rodney discover an 18th-century watch in the garage and manage to auction it for £6,200,000. They proceeded to start new lifestyles with their friends and family but ended up losing all the money in a Central American stock market crash.
Happy Ending Two was in "Sleepless in Peckham". The Trotters have had a year to raise £48,754 to pay off the stock market crash. They do so, with £290,000 left over, thanks to Uncle Albert's will, and Rodney finally gets a child with Cassandra after a miscarriage previously.
The Outer Limits (1995): In "Joyride", the NASA astronaut Colonel Theodore Harris saw a strange violet light while onboard the Aspire 7 on September 16, 1963. The light enveloped the capsule and he aborted the mission. His steadfast claim that he had encountered aliens while in space was not taken seriously and the NASA psychological assessment determined that it had merely been a hallucination. Harris was completely discredited. The continual accusations that he was mentally unstable led him to check himself into a psychiatric institution for a brief period. On one occasion, he even hacked into a computer at The Pentagon in order to access his file but the charges were dropped. Harris is furious when he learns that his old friend and fellow astronaut Wayne caught a glimpse of similar lights during an orbit of Earth but kept it to himself for the sake of his career. In the words of his wife Madelaine, he was a "one-man train wreck". Although she left him because she could no longer handle the stress, they never stopped loving each other. On a second trip to space aboard the Daedalus XL-141 in 2001, Harris once again encountered the aliens. As their intention had been to observe but not interfere, they send him back in time to 1963 and alter history so that his mission was successful. He has the opportunity to live his life over again and avoid making the same mistakes.
Parade's End has one hell of a trip until Christopher and Valentine end up together. Christopher's manipulative wife, who only cares about him when she thinks another woman is attracted to him, repeatedly tries to rip them apart. Not to mention that Christopher has to serve in World War I for years while battling his own outdated moral code (which he himself despises). Four episodes go by without a kiss or so much as a declaration of feelings (although Valentine does agree to be his mistress, although the act is initially unconsummated). The Love Triangle finally ends when Christopher resists Sylvia's manipulation after she cuts down the Groby tree and decides to start over with Valentine and the two are finally together.
Stargate SG-1. Applies to the series as a whole, but most particularly in season nine and ten. World after world bows down to the Ori, SG team members getting killed left and right (even a lot of normal people on earth thanks to the Prior plague), villains constantly getting away scot-free and in two years, barely a dent is made in the Ori attack. Then Stargate: The Ark of Truth kicks down the Downer Ending's door, beats it up with some Moments of Awesome and proceeds to give the team the Happy Ending they deserve.
Likewise, the Tok'ra. The SGC's occasionally reluctant (due to differences of opinion, primarily regarding the SGC's overt methods vs their insurgency tactics) allies, they're not always the most sympathetic and tend towards Good Is Not Nice at best. However, throughout the series, they're experiencing negative population growth thanks to their entire civilisation being the product of one reformed Goa'uld Queen, Egeria (who only reappears after a couple of thousand years to be Back for the Dead), meaning that any one of them who dies brings them one step closer to extinction. Being locked in a Forever War with an enemy that far outguns them, meaning that they're always on the run, doesn't help. Yet, at the end of Stargate: Continuum, with the last of the Goa'uld System Lords finally destroyed, they finally get to establish a nation of their own, having succeeded at their driving goal.
Happy never comes cheap in Star Trek. Voyager had seven rough years before making it home, the folks of Deep Space Nine went through war and hell before putting down the Dominion once and for all, and both the Enterprise and her captain got beat up pretty good before they defeated the Xindi.
In Voyager, specifically, the end episode begins with a Bittersweet Ending, but then Janeway travels back in time and we get a really happy ending.
Despite the incredible pain and suffering the characters go through, the ending of Supernatural is incredibly uplifting. Chuck is defeated and stripped of his powers, freeing the Winchesters from his machinations. Dean dies shortly afterward, but Sam is able to retire from the hunter lifestyle, getting married, raising a son, and is eventually reunited with Dean in Heaven after dying of natural causes.
Tipping the Velvet: It ends happily, just not as you might have expected. Or wanted, depending on your favored couple. Nan makes her peace with her past and seems to be happy after going through great hardships, but she does not get back together with Kitty nor find fame and fortune. However, she finds new love with Florence.
In The Twilight Zone (1959) (which doesn't tend to have happy endings), the episode "A Penny For Your Thoughts", ends with the main character going out with a co-worker who was attracted to him, getting his job back with a promotion after warning the boss about an embezzler, getting a vacation for a man he wrongly (though justifiably) accused of plotting to rob the bank, and lost his powers (which was good because he hated them).
"Acts of Terror" ends with Louise Simonson putting her abusive husband Jack in his place and leaving him.
In "The Trunk", Willy Gardner learns the hard way that a trunk that grants his every wish causes more problems than it solves as it leads to him gaining many false friends, three of whom attack him and try to steal the money that they think he is hiding. He hides from them in the trunk but finds that he is trapped inside. Sometime later, a woman who has gained possession of the trunk idly wishes that she could find a decent guy to spend the rest of her life with. The trunk then opens to reveal Willy, whose loneliness is finally over.
The Wire: In a show in which practically all victories are of the Pyrrhic variety, and happy endings few and far between, there was much rejoicing in seeing Bubbles walk up those steps...
To an extent, the ending of Hawking (the 2004 BBC drama with Benedict Cumberbatch). Stephen's had to deal with a serious incurable illness while working very hard, but by the end of the movie he's made a scientific breakthrough, his university's offered him a fellowship, his girlfriend's agreed to marry him, and despite his medical issues, he's still alive and doing science.