The sequel to The Exorcist, Legion, Pazuzu scores a shutout win, undoing everything from the first book.
In The Silmarillion, after the fifth battle in the Wars of Beleriand Morgoth has completely devastated the armies of the elves, and shortly crushes all of their kingdoms into dust, reducing their domain to a tiny island off the coast and becoming the undisputed lord of all of Arda east of Valinor. It takes the intervention of the god-like Valar in the War of Wrath to even achieve a Bittersweet Ending.
It's worse in The Children of Húrin, even if the reader knows about the eventual intervention of the Valar.
No Valar intervention in Akallabêth. Sauron manages to corrupt the Númenóreans' minds and causes eventually the destruction of Númenor, a paradise on Earth. To make things even worse, Eru - the Supreme Deity - does the actual destruction for Sauron. Yes, the physical form of Sauron dies with the cataclysm, but he reincarnates quickly. Unlike in Quenta Silmarillion the Valar do absolutely nothing to achieve even a Bittersweet Ending.
To be fair, the last time the Valar intervened, it destroyed half the known world. The maps in the Silmarillion show that the world as of the Lord of the Rings books used to be way off to the east, rather than the extreme west of Middle Earth. They thus swore never to directly interfere again, though they do send emissaries to help guide the peoples of Middle Earth; the wizards.
1984: Winston and Julia are captured by the Thought Police, betrayed by the one man they thought was a friend, viciously tortured, broken by their worst fears (embodied by Room 101) and everything that ever gave them hope crushed without mercy, up to and including their love for each other. Winston in the end is so destroyed that he comes to love Big Brother.
Brave New World: John submits to the influence of soma, rhetoric, and the influence of the crowd's conditioning, and engages in an orgy with the crowd. Having betrayed his beliefs to fall in the decadence of the modern world, he commits suicide.
Ditto with American Psycho and the disclaimer in its own film example above.
In Graham McNeill's Storm of Iron, the Imperial Guard not only lose and are slaughtered, their last ditch effort to prevent the Chaos forces from claiming what they were seeking failed — and they knew it.
There was no way they could destroy it all before the Iron Warriors came to kill them. But they would try. It was all they had left.
See his Dead Sky Black Sun for reappearance of some characters and things from this work.
The later novel Know No Fear does this as well. While the Word Bearers are eventually driven off Calth offscreen, the planet's surface has been pretty much destroyed, and the Ultramarines have been taken out of the fight as far as the greater Heresy goes, so technically the Word Bearers did what they set out to do, which was remove the Ultramarines as a threat.
'Salem's Lot ends badly: though the Count has been destroyed, the entire population of 'Salem's Lot has been vampirized, while the hero and the only other survivor, a child, live new lives in Mexico. There's an epilogue which suggests hope, but later short stories by King reveal that the attempt to destroy the town didn't work, and the vampire population is slowly growing as lost travelers fall prey to them.
Cujo. Although it is somewhat of a Pyrrhic Villainy in that the mad dog dies as well as the child (who lives in the movie version), it is strongly implied that the dog was possessed by the ghost of Frank Dodd (the serial killer from King's novel "The Dead Zone") who was apparently just coming back from the dead for one more murderous rampage.
This happens in some of Stephen King's short stories as well.
Children of the Corn, not the 1984 film, but the original story ends with He who walks behind the rows continuing his control of the children and the heroes dying.
In Gramma, the child realizes all too late what's going on and fails to escape being possessed by his recently deceased witch of a grandmother, who rises, possesses him, and lives again through his young body, apparently to harass or wreak revenge on her hated family anew.
In The Bogeyman (published in the collection Night Shift) the protagonist tries for years to escape the bogeyman who killed his offspring and stalked him endlessly. At the end of the story it turns out that the therapist he's been telling the tale to was the bogeyman in disguise, who evidently gets him.
In The Road Virus Heads North, the main character fails to destroy the magical picture or evade the murderous entity it brought to life who's been stalking him, and he dies a bloody death as a result.
The entire point of Steve Stirling's Draka Trilogy.
Except the New America escaped and now the Draka and Samothracians are fighting through time and alternate realities...
Animal Farm ended with Napoleon securing rule over the farm, with the other animals being treated worse than they were by the human farmer at the start of the novel. Unsurprisingly, since the whole thing is a metaphor for the Russian Revolution. This was changed for the Animated Adaptation.
Madame Bovary, the title character Emma kills herself thanks to huge debts and several failed adulterous flings, her moronic husband dies of exhaustion while putting on a needlessly elaborate funeral, and her little girl gets sent to a mill. Meanwhile, Monsieur Homais, the living form of everything to be hated in provincial life loses a threat to his pharmacy business and later fulfills a dream of joining the Legion d'honneur. Monsieur Lheureux, the man who drove Emma into such debt through clever manipulations and blackmail probably made a pretty penny too.
The heroic personal injury lawyer in the (non-fiction!) book and film A Civil Action loses the lawsuit against the two companies that had dumped toxic chemicals into the local water supply, settles the case for far less than his expenses in pursuing it, and ends up declaring bankruptcy.
Reynard The Fox: In this medieval tale Reynard is the protagonist, but hardly an admirable character. He lies, cheats, murders, rapes, steals and betrays everybody and manages to get away with all of it in the end.
Michael Reaves's Darth Maul: Shadow Hunter, naturally, as it leads intoThe Phantom Menace, although it is not necessarily obvious to readers unfamiliar with Star Wars: Lorn Pavan eventually runs into a prominent senator and hands him the info about the Sith conspiracy, so he dies content when Darth Maul kills him. Unfortunately, the senator was Palpatine.
Outbound Flight. Put simply, of the three sides - Chiss, Jedi, and Separatist - Chiss beat Separatist and used its remains and a different enemy to kill Jedi. But the book's major players have Grey and Gray Morality. Jedi were not all virtuous, there was honor among some of the Separatists, and the most prominent Chiss was Thrawn, who despite coming out on top was visibly unhappy to have indirectly killed fifty thousand innocents. The only real winner there was Palpatine, who sent Jedi and Separatist out in the first place. He got rid of the Jedi on Outbound Flight, and a single Separatist force was sacrificed, except for his agent, but in the process he was able to start encouraging one of the galaxy's greatest strategists to work for him.
Hero of Cartao is another story by Timothy Zahn where Darth Sidious and Kinman Doriana win. It has the Republic and the Trade Federation fight over a unique factory, with both sides being careful not to damage it. Just when it looks like the Republic is winning after all, they seemingly get reinforcements in the form of a transport carrying Jedi … that drops onto the factory, destroying it, along with the Jedi's reputation in the region, including that of the protagonist even through he had nothing to do with it. The ship was actually remotely controlled by Sidious (or someone working for him), who considered the factory too dangerous and saw an opportunity to harm his enemies as well. Which worked even better than he may have expected, because countless civilians happened to still be in the building.
Hannibal has rather a half-subverted, half-employed use of the trope. In a sense the antagonist of the story is Mason Verger and boy does he lose, but Lecter is kind of a Villain Protagonist as a counterpoint to the genuinely heroic protagonist Clarice, and Lecter seduces Clarice to the dark side and, so far as we know, escapes justice forever.
In the movie version, things turn out better for Clarice. Hannibal still escapes (but has to lop off his own hand to do so).
Played depressingly straight with the John Grisham novel The Appeal. The small town lawyers are rendered bankrupt, the sympathetic banker loses everything, the evil company that ruined the town's water supplynote in a state where appellate and Supreme Court judges are elected, not appointed and the lives of those "trailer park peasants" within its limits walks free with zero punishment, and the Corrupt Corporate Executive Carl Trudeau becomes even wealthier then before (the book ends with him wanting to make even more). All because the verdict led to the executive falling off the Forbes' coveted list of richest Americans.
Played straight and then subverted in Mistborn. The premise is that one thousand years ago, a man set out on a heroic journey. Long story short, The Bad Guy Won. Said Bad Guy, the "Lord Ruler," has ruled as a tyrant for a millennium in a Crapsack World. The events of the book are mainly concerned with finding a way to kill the Lord Ruler and undo a thousand years of damage. The subversion comes when they succeed in killing the Lord Ruler, only to find out that he was keeping an infinitely greater evil at bay for all that time.
Also the end of the second book in the trilogy where the Sealed Evil in a Can that the Lord Ruler defeated successfully tricks the heroine into unleashing it.
While it isn't clear yet what kind of ending the overall A Song of Ice and Fire saga will have (it will be bittersweet at best), the "War of the Five Kings" arc ended with the bad guys winning. Well, the antagonists at least.
As of the end of "Dance with the Dragons" this is most definitely so. Not just Bad, but the Worst guys triumph in almost all the significant parts of the narrative, and all they whatsoever sympathetic characters are either dead, imprisoned, on the run or otherwise removed from the game.
Burmese Days U Po Kyin's plan to humiliate Flory and ruin his reputation with the other English in Burma succeeds spectacularly when Flory decides to commit suicide. Without Flory, the only other competition to join the European club as a native, Dr. Veraswami, disappears from lack of support. U Po Kyin joins the European club. (Though in a bit of retribution, he dies very suddenly before he could work off the bad karma his evil deeds would have accumulated.)
In Codex Alera the Vord overrun Canea and the only thing our heroes can do is flee to fight the other Vord back home. The ending implies that in a hundred years or so, they'll come to Alera, so the heros start to rebuild and hopefully get ready for them.
R.A. Salvatore's The Pirate King, The Crow becomes king of Luskan and Jarlaxle, who set the whole thing in motion at the cost of thousands of innocent lives, gets to become rich as the power behind the throne.
Collection of short stories "Villains Victorious" is based on this trope.
Perdido Street Station ends with the trade union movement crushed, the city's largest subversive newspaper shut down, and the surviving protagonists miserable and fleeing for their lives from both the Orwellian government and a ruthless crime boss.
The Scar ends with Armada's corruption exposed, but with no possible way to clean it up. The city was almost destroyed by both a civil and regular war, and the protagonist is beaten and cowed. The grand orchestrator of all this strife is free and still in a position of power over Armada.
Iron Council ends with a major uprising brutally put down, a violent revolutionary realising that he'd achieved nothing by killing the Mayor, and the largest and most hope-inspiring rebel group in the land being frozen in time.
Lauren Myracle's YA novel Bliss ends with the power-hungry Sandy assimilating herself with a vengeful spirit and becoming popular, while the titular Bliss can only stand back and watch it happen.
The most villainous character in Sarum, Walter Wilson, succeeds in ruining all three of the families he carries grudges against, exploits and abuses his own poorer relations shamelessly, and elevates his family from penniless peasants to rising business tycoons, without suffering any worse payback than his son talking back to him and being snickered at by the king. While the Black Death does kill most of his immediate family, he honestly doesn't seem to care, and uses his own dying son to deliberately infect the Shockleys.
In Chimaera, the last book in the Well of Echoes quartet, almost all magic in the world is destroyed, and the big bad becomes the God-Emperor of everything. The next series begins ten years later, which the big bad has spent enslaving the continent, and the main character has spent in the very bottom level of a prison. Yeesh.
In the Pendragon books, Saint Dane ends up victorious in several of the books; The Reality Bug, where Veelox falls, Black Water, where Bobby and co. end up saving Eelong but greatly weaken the flumes and also leads to Courtney's injuries in the next book and thus to Mark befriending Andy, which finally leads to the worlds becoming integrated, Earth getting overrun by Dados and run by the Ravinians, and most of the worlds collapsing. By the end of the 9th book, it seems pretty clear that Saint Dane has achieved his goal. But overall, this trope is averted, as Bobby manages to save the day once and for all in the last book.
Played for black humor in Tom Sharpe's The Throwback, where one Lockhart Flawse, upon marrying a woman with a bit of real estate and discovering that the lease prices were set by her father years and years ago and that mass evictions and subsequent resale weren't legally permissible, decided to "encourage" the current residents to move out by any means possible. Including, but not limited to, sewage rerouting, oven cleaner-filled condoms and a bull-terrier tripped out on LSD.
Further adding to Forgotten Realms, the sides that win the most in Elaine Cunningham's Starlight & Shadows series are the bad guys; Shakti Hunzrin and Lolth. In ascending order. The former wins a personal one by talking the protagonist into giving her the macguffin that's already served its purpose, the latter wins a landslide in that because of the protagonist, her people the drow can move about on the surface without their equipment being destroyed on the surface.
BZRK ends with the AFGC successfully wiring several world leaders, including the President of the US, and BZRK crippled after everyone and their biots struggle to get out alive, let alone intact. The war's not over, but the bad guys absolutely dominated the battle.
In Dr. Seuss' "The Sneetches," Star-Bellied Sneetches look down on Plain-Bellied Sneetches until a Con Man named Sylvester McMonkey McBean shows up with a machine that can give the latter a Race Lift. The Star-Bellied Sneetches then pay to have their stars removed (so they can still tell who the "better" Sneetches are), and soon everyone gets all mixed up about who is who. The Sneetches eventually learn their lesson, but McBean makes off with all their money, laughing.
At the end of Joe Abercrombie's The First Law trilogy, the only character who gets a happy ending is Bayaz, a wizard who sees the world as his toy and has no qualms about killing countless innocents in order to satisfy his ego. This example is unusual because he seems like one of the heroes throughout most of the story. His true nature isn't revealed until it's too late.
In Christian Nation, the evangelical Christians in control of America in the Alternate History that follows Sarah Palin becoming President succeed in bringing forth "one nation under God"...a Big Brother-ish theocracy where God's law and the Fifty Blessings supercede the Constitution, though it required military effort on the part of the Christians in order to achieve this. The only Hope Spot for the return of freedom and democracy in America is a small La Résistance movement called the Free Minds that the protagonist becomes a part of.