Daniel Handler's A Series of Unfortunate Events: Due to Executive Meddling, the ending of the movie, that closes the story in an ambiguous but optimistic way: "...the Baudelaires were very fortunate indeed". The third book, the last book the movie covers, also ends with this line. The final book of the series, The End, finishes mainly on this bittersweet note (although it's pretty ambiguous, the book explicitly says that their series of unfortunate events has ended). The Baudelaires are finally free of Count Olaf and most of the villains that pursued them, and Kit Snicket's child survives. However, it's come at the cost of potentially hundreds of lives and their own innocence.
The Lord of the Rings: The good guys win. Aragorn takes his rightful place as king. Sauron is defeated permanently, and the Ring destroyed... but this also destroys the power of the Three Rings that has sustained Lothlórien and Rivendell, and the Elves leave. Frodo, unable to bear the weight of all he lost to save the world, leaves with them, as does Gandalf, and magic begins to go out of the world.
The Silmarillion: Morgoth is defeated and permanently banished from the world until the end of time. The two Silmarils remaining in his crown are stolen and then Lost Forever. The continent is mostly destroyed and many of the Elves sail to the West. The romance between the mortal Man Beren and Elven beauty Lúthien. The good news is that Lúthien becomes mortal, allowing her to follow Beren when he dies (Men and Elves have very different fates after death). The bad news is that Lúthien becomes mortal, and thereby passes out of the world and is lost to her people.
In The Hobbit, Bilbo returns home rich, but ostracized as a weirdo by his fellow hobbits. Nevertheless, "he remained very happy to the end of his days, and those were extraordinarily long." And lets not forget that, while stronger than they were at the beginning, the Dwarves' nation has still be irreparably and terminally damaged.
Even the happy ending for Arwen and Aragorn is somewhat tainted, since now Arwen is mortal but still can't quite understand what death is and that it's not always horrible. Imagine living thousands of years and suddenly being faced by a single century. So when Aragorn is dying and tells her that they'll meet again she's freaking out, and spends the rest of her life moping in an abandoned Elf forest.
The Witches by Roald Dahl, although the main characters are very accepting of the ending. In some ways they seem to welcome it. But the boy is unlikely to outlive his grandmother, his only living relative and the only person who seems to care about him. This just makes it worse. It should be noted that the film added a happy ending, much to Dahl's anger.
Hans Christian Andersen's The Little Mermaid: The prince falls for the woman he thought rescued him. The poor transformed, mute mermaid sadly carries her train at the wedding. When offered a chance to become a mermaid again instead of dying by killing the man she loved, she decides not to take it. She does die physically, but God transforms her into an air spirit. This is because mermaids don't have immortal souls, and in fact the mermaid hoped to gain one by marrying the prince. As an air spirit, she will have the chance to shape a soul for herself, though it is clearly stated it will take centuries. Not surprisingly, many prefer the Disney Animated Canon take on this story.
In Robin Hobb's Realm of the Elderlings series, Fitz ends the Farseer trilogy without the woman he loves, telling himself he didn't love her, in a cabin in the middle of nowhere, visited once in a while by a woman who he doesn't care about throughout the series and is mainly a pest. In the sequel trilogy, The Tawny Man, things get better. There's still Bittersweet qualities, but it is overall a happy ending despite the characters that died on the way.
His Dark Materials ends with The Authority destroyed and his Regent, Metatron, eliminated... but in the process, Lord Asriel and Mrs. Coulter are trapped in the space between worlds for eternity, and Will and Lyra are separated into their own worlds because moving between worlds results in the end of Dust. They would've been able to stay together, but people who stay in a non-native world lead shorter lives than they would in their native world, typically dying only a few short years due to disease. Truly unfair.
The true ending of The Dark Tower series: The man in black fled across the desert, and the gunslinger followed.
Under the Dome: The heroes' plan works, and (most of) the main characters get out alive. Unfortunately, they are pretty much the only people who survive. Almost the entire population of Chester's Mill is dead. To top it all off, the box used to generate the dome is still around, and there's no guarantee that it won't be used somewhere else on Earth or in the wider Universe in the future.
IT: The Big Bad has been killed, but the town of Derry was destroyed, some of the Losers were killed, and the surviving Losers are destined to go their separate ways and forget about each other again.
The Eyes of The Dragon: Flagg is defeated but still alive. Thomas is forced to Walk the Earth in order to avoid being the victim of a Vigilante Execution, meaning that Peter has now lost his entire family. On the plus side, though, Peter has cleared his name and become King and it's implied he'll be a good one. There's also a hint that Peter and Thomas will see each other again.
At the end of the Animorphs series, the Yeerk invasion is defeated, but Rachel, Tom, and several supporting characters die in the process. Jake and Tobias suffer from depression and find themselves unable to adjust to life after the war. As if that isn't enough, Ax gets captured by a new enemy and the rest of the Animorphs try to rescue him, only to result in a Bolivian Army Ending. Cassie survives, since Jake knows she's never been a warrior at heart and doesn't take her on the rescue mission. Despite Jake's suggestion of marriage in #53, they drifted apart afterwards and Cassie is dating someone else. That's both official couples torpedoed, since Rachel is dead. Tobias has Rachel's ashes, and unless he traps himself in a morph that lives longer than a red-tailed hawk, he may get to be Together in Death with her soon afterward. The Animorphs universe apparently has some sort of afterlife, as Rachel's spirit got to talk to the Elemist for a few moments before continuing on its ghostly way to Ascend to a Higher Plane of Existence or whatever.
Brooks' World War Z: We make it, but the whales don't. Also, the death count's stratospheric.
"Bittersweet" is probably the most optimistic you'll ever get from George R. R. Martin..
At the end of The Hedge Knight, Dunk has survived his trial by combat and gained a squire, at the cost of Prince Baelor's life.
Amazingly enough, he's managed to stay just optimistic enough to make every book in A Song of Ice and Fire have a Bittersweet Ending. Even A Feast For Crows, which holds some sort of record for being the darkest book in an already rather dark series.
Neil Gaiman's The Graveyard Book ends on a bittersweet note, with Bod defeating the bad guys so that he is safely able to leave the graveyard and join the outside world. However, doing so means that he can no longer see or hear the dead which he grew up with, including his adoptive parents, and must join a world utterly unfamiliar to him. He's also rejected by his childhood friend Scarlett, the only living person who he had a connection to, who ends up afraid of him and decides that she would rather forget his existence.
The Graveyard Book is heavily inspired by Rudyard Kipling's Jungle Books, which also have bittersweet endings. In The Jungle Book Mowgli succeeds in killing Shere Khan but manages to alienate both the wolf pack and the human village in the process. In The Second Jungle Book Mowgli is reunited with his human mother but is forced to give up his life in the jungle.
Coraline isn't very happy in book version. The heroine's parents neglect her as before (as opposed to the movie, here it is permanent). And the Other Mother is still alive and may get out should somebody force the door open. And of course, any possible wonders are evil, so we should just stick to our world, with all its problems.
The end of the Drizzt Do'Urden novel The Legacy has Drizzt and his friends fighting off the drow and Artemis Entreri... and Wulfgar dying to save his friends from a demon, the brave dwarven priest who was going to officiate his and Catti-brie's wedding being crushed to death, and a threat of an army of drow coming upon Mithral Hall. Yay?
The Hunter's Blades trilogy finishes with Mithral Hall holding out against the newly-founded Kingdom of Dark Arrows long enough and bloodily enough that King Obould decides to halt his advance. Gerti Frostdottir, the frost giant priestess, decides to sever her ties with the orc king. Drizzt and Catti-brie finally get horizontal and then get married. The Companions of the Hall have once again come through alive and mostly well. But the orcs have gained a large foothold in the Silver Marches, Pikel Bouldershoulder has lost an arm; Wulfgar's wife, an allied human mage, several of Drizzt's new friends, dozens if not hundreds of elven warriors, hundreds of humans (including civilians), and hundreds if not thousands of dwarven soldiers are dead; as well as many, many orks but well, they had it coming, and Wulfgar's daughter has been kidnapped. On top of it all, Lady Alustriel, the figurehead of the Silver Marches, is leaning on her people to let the orcs stay, as dislodging them would be far too costly to be worth it.
Salvatore'sThe Orc King. While in the Kingdom of Dark Arrows and Mithral Hall become uneasy allies and Wulfgar's daughter is found, Wulfgar leaves the True Companions for Icewind Dale, giving his daughter back to her blood mother. In The Pirate King, the city of Luskan is all but destroyed in a war to dislodge its hidden master — and while he loses, said lich still survives. Meanwhile, Longsaddle is still going, but has been reduced to a sadly blatant allegory for modern America with its security woes. On the other hand, while Wulfgar ain't comin' back, he's not only going to survive, but thrive back in his true home. Finally, in The Ghost King, the Spellplague hits, and while the Ghost King is destroyed, in the process Catti-brie and Regis take the ships a unicorn to Mielikki's garden, and Cadderly sacrifices his life and indeed the Spirit Soaring itself to do the deed, to say nothing of the destruction of Carradoon and the many many people killed by the Ghost King's attacks, armies, and the Spellplague itself. On top of that Cadderly's spirit can't move on, because he has to continue circling the ruins of Spirit Soaring to renew the spell that prevents the Ghost King from coming back. Good times, huh?
Forgotten Realms' Starlight and Shadows trilogy: Most participants who managed to stay alive grew wiser. Part of damages from the Times of Troubles is repaired. Liriel survives and finds some friends, but Fyodor is dead and not to be resurrected. Products of drow radiation magic works on surface without deterioration - mixed blessing at best (though may be Weave repair).
In Dan Abnett's Warhammer 40,000: Ravenor series, the title character finally brings the Big Bad Molotch and two other Big Bads to justice, effectively saving the entire Imperium of Man. However, by the time it's all over, his entire retinue has reached the emotional breaking point. Pretty much all of Ravenor's remaining followers are either arrested, leave, or disappear with only one member loyally staying by his side. The last book ends with Ravenor himself having to appear before his peers in order to answer for his actions as a rogue inquisitor. The dialogue implies that Gregor Eisenhorn has either turned to Chaos, become a dangerous radical or suffered a Fate Worse than Death.
Abnett's 40k series Eisenhorn ends with the title character having defeated the Big Bad's apocalyptic plan, but with most of his companions dead in the process and the rest going their own way.
The Chronicles of Prydain end with Taran essentially making the opposite of Frodo's decision in Lord of the Rings. While his friends and companions go off to a paradise across the sea to spend eternity in happiness, Taran chooses to remain behind to attempt to restore Prydain. Sure he gets to be High King as part of the deal, but that doesn't take the sting out of never seeing your friends again. At least Princess Eilonwy decides to stay with him too. The ending gets extra bitter points as Taran tries to rebuild Prydain because he made promises to comrades, often over their graves, to finish their work for them. His "World of Cardboard" Speech to the other companions, explaining why he cannot go with them, drives home for everyone just how much it cost to win peace for Prydain. Taran gets Samwise's ending (without the Ringbearer tag).
The Westmark trilogy ends with the country retaken, the people finally given a democracy, and Official Couple Theo and Mickle married after years and two books of waiting; but with half the supporting cast dead including all of Florian's "children" besides Theo and the companions going into semi-voluntary exile.
"The First Two Lives of Lukas Kasha" ends with the main character saving the day, learning his lesson and being very violently torn from all the friends he's made over the course of the book including the girl he may or may not have fallen in love with, along with any influence he may have had over that world. Instead, he is sent back to his home where everyone thinks he's a worthless layabout and no one believes he was almost a king, and a good one at that. He leaves the town in order to spend his entire life searching for a way to get back into Abidon.
"The Rope Trick" ends with the characters very narrowly escaping the bad guy's clutches, the main character finally accomplishing the thing she's been trying to do all novel, and entering a land of peace. The bitter part? None of them know if they're alive, dead, or nonexistent. Lloyd Alexander is quite fond of these.
Joe Abercrombie's The First Law. The Big Bad is defeated and his army routed. Jezal is king. West is a Marshall. Dogman is a respected leader in the North. Glokta is both Arch-Lector and married to Ardee. Logen has settled his score with Bethod. Ferro gains new powers to enable her to take her revenge. On the other hand, Bayaz is revealed to be a megalomaniac dictator no better than Kahlul. Jezal is a puppet utterly cowed by Bayaz. West is slowly dying from exposure to the Seed. Logen may or may not be dead by Black Dow's hands. Lastly, Adua is left utterly in ruins and afflicted by the sickness brought on by the Seed.
In Ray Nelson's short story Eight O Clock In The Morning, the protagonist, through a mixture of resourcefulness and sheer determination, manages to lead humanity to rebel against the man-eating lizard men who had taken over the world... and used their mind control powers to keep anyone from even realizing it. However, he never actually gets to see this, as the command that gives the story its title kills him the next day.
The conclusion of Garth Nix's Abhorsen: Hedge is dead, Orannis is bound anew, and most of the main characters, plus the innocents they were trying to protect, survive. However, Lirael loses her hand, Nick will have to struggle against the Free Magic still in his blood for the rest of his life, and the Disreputable Dog is dead. Or is it? This is one of the Seven we're talking about here...
The Name of the Wind: Kvothe saves the village of Trebon from the rampaging Draccus, finds the titular name of the wind, avoids being expelled from The University and is actually promoted up the ranks, and beards his rival Ambrose yet again while his fame rises. However, in doing so he had to destroy the denner resin he was hoping would provide for his future, the villagers of Trebon bury the remains of the Draccus (costing him and every other researcher the chance for a unique study), and, worse, because he Cannot Spit It Out to Denna he winds up becoming something of her Unlucky Childhood Friend. Not to mention the seething hatred Ambrose has for him is cranked up yet another notch (and it was already at murderous levels). He himself sums it up best: "Oh, it's just the same thing you've heard a hundred times before. Prince Gallant kills the dragon, but loses the treasure and the girl." From the way the Framing Device is set up, it's implied that his whole adventuring career has been this way.
The Bartimaeus Trilogy ends with Nathaniel redeemed, Bartimaeus freed, and the commoners gaining a greater voice in their own government. Of course, it also ends with Nathaniel dyingat the moment of his redemption and Kitty's budding friendship/morethanfriendship cut off, leaving her alone and aged from the effects of Ptolemy's Gate. The new government that replaced the wizards (whom Kitty helped to overthrow) was hinted to be just as petty and corrupt as the previous one, and the unmentioned fact that the Americans will become the next great empire based on magic and subjugation of demons, bringing the whole bloody cycle around yet again.
Isaac Asimov's Foundation series. The protagonists find Earth and civilization continues to revive, but the Second Galactic Empire will never come, humanity will probably lose its individuality and become part of a galaxy-wide organism. Also, the fan-favorite robot will die in some centuries, but not before he possesses an innocent Solarian child who has the potential to undo 30,000 years of social engineering on its own. The earlier books contain quotations from an "Encyclopedia Galactica" published during the Second Galactic Empire, it seems safe to say that something would have intervened to prevent Galaxia from arising had Asimov decided to finish the series properly before he died. (Or, as suggested at the end of the Second Foundation Trilogy, the Second Galactic Empire was able to somehow incorporate Galaxia.)
The Lies of Locke Lamora: Locke successfully takes revenge on the Grey King, but he is left with only one of his friends still alive, and he has to leave Camorr forever. Locke himself sums it up: "So this is what winning feels like....it can go fuck itself."
The sequel Red Seas Under Red Skies: Sure, Locke and Jean have brought down the Archon and gotten away from Tal Verrar, and the pirates aren't going to be hunted down and killed, but in the meantime Jean's girlfriend is dead, they failed in the robbery they came for in the first place—and, oh yeah, Locke is dying slowly from poison.
This is about the best you can hope for with anything by Harry Turtledove. If it's not a straight-out Downer Ending, it typically goes like this: There's an overall victory for the good guys, but the world is irreperably changed, a lot of good people died or have their lives ruined, and a lot of bad guys are no worse off. Most of what Turtledove writes is alternative history fiction, which is generally presented in such a way as to be as "realistic" as possible — and life itself rarely produces anything other than Bittersweet Endings.
Nearly every book in the Honor Harrington series, due to heavy loss of life during each and every final battle. At All Costs is the worst, with the Manticoran Home Fleet completely wiped out and her friend Alistair McKeon killed only suceeding in gutting the Haven offensive forces with their defenses and production still intact. By Storm from Shadows they stop being bittersweet and start being Downer Endings. Torch of Freedom is a nasty case of Yank the Dog's Chain disguised as a Happy Ending. Reading the books in the correct order means while not quite a Shaggy Dog Story, it's only marginally better as their sucess won't stop Oyster Bay or the eminent war with the Solarian League. The corner has been turned as of Mission of Honor. Oyster Bay has finally had its trigger pulled (with nearly every major shipyard in the Manticore system destroyed as a result), and the war with the Sollies has finally started.... but on the other hand, the RMN has proven itself capable of kicking the Sollie navy's ass without trying, and Manticore and Haven have made peace, as well as agreeing to a military alliance that will probably take the starch out of the SLN's impending attack of Manticore).
The ending of Patricia Bray's Chronicles of Josan trilogy. Josan, whose soul has been forced into the body of the prince (and later emperor) Lucius, discovers that the body will die in the strain between two souls. He sets things up so he can banish himself, as the interloper, but Lucius takes over the body at the last second to banish himself instead of Josan, having come to the conclusion that Josan is the better leader of the two of them, and more fit for the office of emperor.
Cormac McCarthy's The Road. The father dies, completely uncertain and afraid of his son's future in the post-apocalyptic wasteland. It's believed to have been a worthwhile sacrifice, however, as his son was finally able to find some place safe to be raised by decent people. The ending is then given even more bittersweetness as the epilogue implies that humanity will never be able to recover from the catastrophe that befell the earth, and will eventually die out completely. Still, given McCarthy's usual Kill 'em All tactic, this is practically a parade with balloons and circus animals.
In James Swallow's Warhammer 40,000Horus Heresy novel The Flight of the Eisenstein, of all the loyal Marines who fled, three survive. Their last companions are slaughtered by one of their number's succumbing to Chaos taint. One has become The Atoner. They are effectively prisoners on the Moon. The Lord Regent himself comes to assure them — in person, by way of apology — that there are plans in motion that will have a place for them, but there is no more detail than that. (Although the details of the plan may hint to the readers what will become of them.) Considering that this is a Horus Heresy novel, this is probably as good as it can get. The Horus Heresy itself has a very bittersweet ending — the surviving Primarchs drive off the forces of Chaos, and Horus is utterly destroyed (perhaps showing the slightist amount of regret), but The Emperor is mortally wounded, the power of the Imperium is all but shattered, and the galaxy begins its slow slide into anarchy...
At the end of Graham McNeill's Warhammer 40,000Ultramarines novel The Killing Ground, the ghosts have been laid, the world is not put under Exterminatus, Uriel and Pasanius have been cleared of any taint by the Grey Knights and returned home, but the Unfleshed are all dead — the Lord of the Unfleshed a Mercy Kill at Uriel's hands — and he feels unshakeably melancholy thereafter.
The final volume of the KonradWarhammer Fantasy novels features Konrad defeating the Skaven plot to take over the Empire, and screwing with his adversary's plans. Unfortunately for Konrad, said enemy escapes, and he is forced to behead his first love; for bonus points, it's implied he may not survive what he's getting into at the end. By this point, most if not all of his friends and allies are dead. Of course, this is from a Games Workshop universe, so it should come as no surprise that this is actually the most optimistic part of the novel.
Outbound Flight. Some things, like the destruction of the Outbound Flight on the cover and the fact that only a few people survived, are known from Timothy Zahn's previous novel set years later, "Survivor's Quest. We also know that the survivors and their children hate and distrust the Jedi who lead the Flight, none of those Jedi survived, and a lightsaber and one charric, the signature weapon of the Chiss, were found in a certain part of the wreckage. You find that the one most sympathetic Jedi on board, the one who was almost able to avoid all that, did a Heroic Sacrifice to save the survivors, which wouldn't have been necessary if they'd just stayed put'', and didn't think twice about it. And the Chiss — who happened to be Thrawn's less-genius brother — helped, and no one even knew what they did. It's borderline Downer Ending.
Fire Bringer by David Clement-Davies ends with many of Rannoch's friends being killed off in the final battle, though the evil is defeated and Rannoch becomes Lord of the Herd. Then the epilogue ends with his wife dead, the herd forgetting him, and him wandering off to die of old age. Cheery, isn't it?
The Sight by David Clement-Davis ends with a huge amount of the main characters dead, Larka dying, even though she tried to save herself whilst killing Morgra in the process, and Fell leaving the pack and becoming a kerl — a lone wolf. Kar meanwhile, beigns to slowly lose the will to live before Larka comes to him a dream, and tells him to snap out of it. On a happier note though, Huttser and Palla have some more cubs, and name them after the dead members of the pack, and the final line is a rather What Do You Mean, It's Not Symbolic? one.
P. G. Wodehouse's Regger Pepper story Absent Treatment. Reggie manages to get his best friend and his wife back together, but the wife grossly misinterprets his actions and they become much more distant from Reggie. He closes by stating that he wants the following to be engraved on his tombstone: "Here was a man who acted from the best motives. There is one born every minute."
In Bones and Silence, Peter and Ellie Pascoe finally figure out who intends to commit suicide. Peter can't stop her.
The murderer in Deadheads is never caught; in fact, several years later, he's still one of Pascoe's next-door neighbors!
Dalziel and Pascoe entirely botch the Serial Killer case in Dialogues of the Dead, and the murderer is dating Hat Bowler...
Death's Jest-Book ends on a note of profound gloom: one major player commits suicide; the young male prostitute Wield befriends is killed; and Franny Roote is shot multiple times and nearly dies. To top things off, the murderer from Dialogues of the Dead dies of brain cancer, leaving Hat Bowler distraught.
The book version of The Princess Bride has this ending. William Goldman relates a cliffhanger ending, and then skips it, and then ruminates that maybe life for the heroes wasn't really perfect ever after, and finally he concludes, "Life isn't fair. It's just fairer than death, that's all."
The Dragon Keeper trilogy ends with Ping finding the Dragon Haven, and Kai being revelaed as a dragon of five colours - meaning that he's the next rightful leader of the group of dragons there. However Ping leaves, due to her not belonging there/the other dragons not wanting her there, and she's blinded for flight away so that she will never be able/allowed to find the Dragon Haven again. It's not all bad though, since Ping meets up with Jun and decides to go and live with him, and Kai gave her on of his scales, so that when there's a "Dragon Moon" (a full moon), Ping can dream of him.
The novel Turn Coat, Morgan has not been executed for a crime he did not commit; he died heroically, and killing the villain. So, they merely say that he and the villain were in league. Thomas is alive but seems to be reverting back to the native nastiness of a vampire. Harry has learned that Luccio never really loved him. The White Council refuses to admit to the existence of the Black Council. So Ebenezer and Harry decide to conspire behind their backs, and will be executed if caught. Although Harry peptalks the rest of the werewolves into carrying on, Kirby is still dead.
Some of the earlier ones aren't exactly uplifting. By the end of Death Masks, the Denarians' plot has been foiled, but Susan has left town again, and Harry comes to accept that they will never be together. He even puts away the pictures and engagement ring he'd kept on his mantle for three years. At the end of White Night, the current antagonists in the White Court have been eliminated in the coup, but Lash (the reformed shadow of a fallen angel) sacrificed herself to shield Harry from a psychic attack.
Warrior Cats: Sunrise. Hollyleaf is presumed dead, and almost everyone's lives have been ruined (it's implied that Leafpool is suicidal), but the prophecy still hasen't been completely fulfilled, and there's going to be another series. From Jayfeather's point of view, the continuation of the series preventing this ending from being final apparantly makes all of this less sad.
In The Three Musketeers, the title heroes (plus d'Artagnan) win out against Milady and Richelieu, but at the cost of the death of Madame Bonacieux, d'Artagnan's love interest, not to mention how the trial of Milady has soiled the soldier's life for his three friends, leaving him alone within the Musketeers by book's end. The following books are little better: d'Artagnan is utterly shafted by the Queen and stuck as a minor officer for over 30 years, it takes him restoring the King of England to his throne before he's given any respect. He eventually dies to a cannonade after opening the box that held his marchel baton, the thing he was working for since the first book. Athos' son with Milady comes back and tries to murder them all, until Athos is forced to stab him and leave his body at sea. His second son, a bastard with one Aramis' mistress, eventually rushes into battle to die because the love of his life is the willing mistress of his king. Athos dies of grief from this. Porthos and Aramis however come off rather well for the most part, with Porthos marrying his mistress and her dieing soon after, leaving him with a modest fortune which he builds to near Scrooge McDuck levels of wealth, though he is the first to die via mountain crushing. Aramis is eventually forced to flee to Spain after his attempt to replace the King of France with his Good Twin, but other then the massive guilt of causing the death of Porthos, he's remarkably well off, becoming the Superior General of the Jesuits, and ambassador of Spain to France.
End of Polish novel Wroniec (title doesn't have an equivalent in English, but it's something similar to raven and crow). The main character saves his familly, and his Uncle has Heel-Face Turn, but he has to sacrifice his gift and a part of his innocence and not only titular Big Bad wasn't defeated but it's clearly said, that even if he would be, another one would just take his place and nothing would change. And poor Mr. Beton was eaten by ravens.
In Piers Anthony's Incarnations of Immortality Book 5: Being a Green Mother, Orb almost destroys the world in a fit of rage after she finds out Natasha is "Ah, Satan" backwards, but then saves the world by fulfilling her prophecy and marrying Evil/Satan so that Chronos will reverse time to before she got mad. But then it turns out ends up falling in love with him in the later books. It's Bittersweet because they're separated and it's not until book 6 that we find out how it really ends for them.
The Lovely Bones ends with everyone finally moving on from Susie's death and Harvey dead. However, he's never caught and brought to justice for the numerous murders he commited nor were Susie's remains recovered for a proper burial, which still left the entire case unresolved for her family.
Push by Sapphire ends with Precious being a little bit better off, but the reader knows that she will more than likely never get out of poverty. What makes it worse is that Precious has developed AIDS and will probably not live past her twenties. (In The Kid, the sequel to the original, Precious dies in her mid-twenties.)
The Time Traveler's Wife has a two parts bitter, one part sweet ending. Bitter #1: Involuntary time traveler Henry dies at the age of 43, when his wife Clare is 35. Sweet: Henry leaves a letter in which he tells Clare that (while living) he time traveled to the future and they see each other again there. Bitter #2: They see each other 47 years in the future ... when Clare is 82 years old. The Film of the Book softens this considerably by having them meet again not too long after his death.
In Dale Brown's novel Fatal Terrain, the Chinese threat to Taiwan is defeated, though not before many Taiwanese die, Guam gets nuked andBrad Elliott pulls off a Heroic Sacrifice. In Battle Born the extremist Korean military leader is killed, stopping a war between China and Korea, although it costs one main character's life and China is still very much capable of marching in should it desire.
The Keys to the Kingdom ends with Arthur as the New Architect with all of The House destroyed, including almost all of the denizens except for a choice few, as well as his mother. Arthur is split off from the New Architect, but it lied to about being mortal again, and will probably result in Who Wants to Live Forever?.
The Divide Trilogy by Elizabeth Kay ends with the eponymous Divide closing - forever, and Felix and Beytony both being split into two copies of themselves (one pair of them in each world) as a result of being across the Divide when it shut. Although each pair manages to find out what's happened, Magic-world Felix will never see his parents again, but learns that his heart condition is perminantly healed. On the other hand, Human-world Betony will never see her recently un-petrified parents, and (apart from her eyes) looks like a regular human, whereas Human-world Felix will probably never learn if his heart condition is permanently healed.
The original short story version of The Midnight Meat Train can be interpreted as having one by a sufficiently twisted reader. Sure, the protagonist has gone insane, had his tongue torn out, and is forced to kill people for the immortals who secretly rule New York... but he finally loves the city.
Ringworld In Larry Niven's The Ringworld Engineers the protagonist and his party kill 1.5 trillion people, a couple hundren times as much as the Earth's entire population. And they're marooned on an alien world far from home. On the other hand they save 28.5 trillion people, several thousand times the Earth's present populations.
Les Misérables. The fight for freedom has been utterly crushed, and Jean Valjean dies along with nearly everyone else, but he is reunited with Cosette, who gets together with Marius, and with an angel waiting to take his soul to heaven.
Dragon Slippers: The war is ended and the evil princess killed, but so are good dragons Shardas and Velika. Luckily, their death is not permanent, so it ends with a ray of hope.
The Last Unicorn has a very bittersweet ending: the unicorns are freed, but Lir loses his love, and the questing unicorn has learned to regret (something her immortal kin can't understand).
Arthur C. Clarke, Childhood's End.
In Harry Potter, even the first two parts of the series, while being children's books, are kind of bittersweet, as we know that Harry has to return to the Dursleys for the summer. "Prisoner of Azkaban" is even more so, as Harry now knows that he has a godfather, but he can't live with him. "Order of Phoenix" ends on a relatively happy note, but many terrible things (including Sirius's death) have happened during the year. "Goblet of fire" and "Half-blood Prince" belong to a different cathegory: These two installments are relatively light-hearted, until we get to the downer endings. "Deathly Hallows" sees Voldemort and his Death Eaters have been destroyed or scattered, and Harry is free of his burden. On the other hand, many wonderful people have died. Then it jumps to a Distant Finale where the main cast is Happily Married and sending their own children to Hogwarts, thus leaning towards And the Adventure Continues.
The first book in the Farsala Trilogy, with an emphasis on bitter. The trilogy as a whole has one, too, though there the emphasis leans more toward sweet.
Snot Stew: Toby survives his brutal mauling, but his tail is gone, and the book ends with him reconciling with his sister while crying over the loss.
Yagu, the Blue Wolf: The titular character gets rescued by his master, but in the process most of his former pack, including his sister, gets killed.
Christopher Moore, a writer who (ostensibly) sticks to the humor genre, has a few bittersweet endings to his novels.
Bite Me, the continuation of Bloodsucking Fiends and You Suck, ends with the vampire hordes destroyed, Abby and Tommy saved from their eventual deaths as third-generation vampires, and the three vampire lords dead... but Tommy can't handle being a vampire, and Jody doesn't want to return to being human, and so Jody leaves him, presumably forever.
Tiger Moon by Antonia Michaelis ends with Lalit/Lagan rescuing Safia/Raka, having been encouraged by the (true) story of Farhad and Nittish, who attempted to rescue her. In the attempt though, Farhad is killed, and Nittish is turned to stone after being exposed to tears. However, Farhad gets reincarnated as a good and prosperous man (and is implied to be reincarnated by Krishna himself), and Nittish's soul leaves the statue, entering into the body of a strong young tiger who died and whose soul had already moved on, getting to finally be a normal tiger again.
In the Dominic Flandry series; Flandry succeeds, but loses any woman he truly loves, feels guilty about hurting the feelings of the others, and in one story is troubled by the contrast between a number of honest, decent rebels, who are at best going to be locked up for the rest of their lives, and the decadent Emperor. And the prequel novel had a back-cover blurb which summed up:
Though through this and his succeeding adventures he will struggle gloriously and win (usually) mighty victories, Dominic Flandry is essentially a tragic figure: a man who knows too much, who knows that battle, scheme, and even betray as he will, in the end it will mean nothing. For with the relentlessness of physical law the Long Night approaches. The Terran Empire is dying...
The Time Patrol stories as well, because the Patrol will sacrifice anyone to preserve the time line. Manse struggles to save Keith in "Brave To Be A King" — after a Love Triangle resolved with Keith as the winner — but only manages to get him back after years and years of his life, which leave him a Stranger in a Familiar Land, and Manse still remembers the men he killed, and how one died begging for Forgiveness and citing all he did as The Atoner, even though his efforts had written those out of history.
In "Time Lag", Elva succeeds in aiding her planet, and her planet crushes the invading navy. She still lost her husband, she spent years as a concubine, and she is a Fish Out of Temporal Water — only the assurance that her son survived, though he's an old man now, and she had other descendents, and others who will welcome her home, makes it even bittersweet.
Lord of the Flies: The navy comes to the rescue but several of them are dead and the rest traumitized. They have to go back to what is likely a world in the middle of nucular war.
Monster Blood Tattoo: Rossamund and the majority of his friends survive all the adventures, but he can never see any of them again.
Lady: My Life as a Bitch ends with the main character stuck as a dog likely forever and forced to flee from her former family...but she now has two fellow dogs as close friends, so at least she won't be completely alone in her new life, and may even come to enjoy it with their help. On the other hand, the man who accidentally caused all this is still at large, and will most likely end up accidentally turning others into dogs further down the line...
Horus Heresy, "Mechanicum": Through the efforts of the loyalist adepts, the Dark Mechanicum have been dealt serious blows, Dhalia has found her place as a guard of the dragon, and the machine that has been stalking the main characters is defeated. On the other hand, the Legio Tempestus is annihilated, only two of the Knights of Taranis remain, billions of lives have been lost, with many more still to come, along with limitless knowledge and the bright future it could have given mankind with it, and the Book of the Dragon has been stolen, probably to cause doom and gloom in a galaxy full of it already.
Laura and the Silver Wolf ("Laura und der Silberwolf") : Two girls, Laura and Eileen share a room in a leukemia ward. Laura doesn't make it, but Eileen does. And if it wasn't All Just a Dream, Laura lives on in Ice-Land.
What They Always Tell Us: The main character's love interest goes to a university in New York, his friend Henry moves away, but he gains a new friend in his older brother's ex-girlfriend and hopes to keep a long distance relationship with his boyfriend and he finally has a happy friendship with his brother.
The Vast Fields of Ordinary: The main character learns that no matter where you go your problems will haunt you until you confront them, which he didn't completely comprehend until his ex-Whatever committed suicide by running his car into a tree. Various things that weren't a side effect of this and the author trying to make this as bittersweet as possible, his best friend Lisa goes back to California but visits often, his perfect boyfriend stays in town to take care of his grandma and they mutually break up because the main character has to go to college where he makes new friends and finally starts being happy with what life throws at him.
In Marti Steussy's s-f novel Forest of the Night, the main character fulfills her childhood dream in the end. But by then, her mentor is dead, as is the disabled native child whom she'd befriended. She's had to dump her boyfriend, because it's clear he'll never fully understand her. And she's become generally disillusioned.
The ending of the series as a whole was quite happy, but a number of the installments in Fred Saberhagen's Books Of Swords series were bittersweet at best.
Mindsword's Story was almost just a Downer Ending. The threat posed by the Mindsword has been repelled, at least for the moment, but it has hardly been defeated altogether. In fact, Vilkata is still at large and in possession of the Mindsword. Murat, who started the book with the best of intentions is dead along with his son, who really was innocent. On top of which, Princess Kristin is crippled and still in love with Murat, insisting that Mark is no longer her husband. At the end, Mark has won, but he's left standing there in the rain.
The Third Book of Swords, the conclusion to the trilogy, has a somewhat bittersweet ending. Vilkata is defeated, and Mark gets to be a prince, so it's a basically happy ending. But even though the gods were, frankly, jerks, it's still rather melancholy to see them die. And not every single one of them was evil; Aphrodite's death was particularly poignant, precisely because she had come to sympathize with mortals.
The ending of the Empire Of The East trilogy, set in an earlier period in the same universe, is happy except for one key point: Ardnehdies.
Although the Sentinels beat the Big Bad, Wearing the Cape ends with a state funeral for close to half the team.
One Day ends with one protagonist picking up the pieces of their shattered life and moving on after the love of their life was killed, while keeping the memory of them as a couple alive.
Number the Stars: Ellen and the other Danish Jews escaped to safety, and after a Time Skip Denmark is liberated from the Nazis. However, Peter dies and is buried in an unknown grave, instead of with Lise. Also, Lise's death before the story becomes bittersweet once it's revealed that she was part of La Résistance and was actually run down by a Nazi car.
Player Piano: Dr. Proteus participates in the initially successful revolution with the Ghost Shirts, but in the end, they realize that they have little hope of changing the society further.
The Sirens of Titan: Rumfoord dies (or rather, disappears in space) without making amends with Salo, and Malachi Constant dies. Salo does, however, create illusions that make Malachi's final moments happy.
Mother Night: Campbell's status as a double agent is confirmed, therefore clearing his charges for crimes against humanity... but he chooses to hang himself for "crimes against himself".
Purple Hibiscus has one of these. The main character is a confident, free young woman but her father is dead, her brother is in prison and her mother is traumatised. It is implied things will soon take a turn for the better, however.
The Elenium ends with the death of Azash and Sparhawk returning home to his wife and daughter, but along the way we have the deaths of Kurik and Martel, an entire nation left with no government or diety to watch over it, and an entire pantheon of gods who have retreated from interacting with mortals after realizing that they can be killed just like Azash.
Inheritance Cycle In the end, Eragon defeats Galbatorix and all ends well in Alagaesia, he has to leave the place. Even after Arya and Eragon all but say they loved each other they separate because of their duties. Poor Nasuada was left alone by Murtagh, when he leaves for his soul-healling trip.
The ending to Stravaganza: City of Masks is bittersweet. Lucien has stravagated to Bellezza and is held hostage by the sinister Di Chimici while his real body is still in the real world in a coma. Lucien's parents can't wake him up so they take his unconscious body to the hospital, where his body is put on a life-support machine. He doesn't recover as he can't return because he needs a Bellezzan book to return home and because of the Di Chimici holding him prisoner, so the doctors switch off the life-support machine and his real body dies, leaving Lucien unable to ever return home. The Di Chimicis' evil plans are thwarted, however.
The House at Pooh Corner ends with a fairly sad note, as Christopher Robin is going to leave Hundred Acre Woods. The final chapter is about his farewell. While the ending remains true to the fairly lighthearted tone of the series, what Christopher is saying remains very poignant - he's growing up and can't be a child anymore.
Daniel Quinn's Ishmael ends with the titular teacher's death, but he had taught all that the narrator needed to know to save the world.
Mario and the Magician: the evil magician who manipulated everyone is shot dead, ending his power, but Mario will probably go in jail for it. And of course, this death won't change that Italy further descends into dictatorship (and we now know that Germany will follow shortly.)
Every book from the GONE series seems to end with victory for the protagonists and sometimes the sympathectic villains, but also has a slightly bitter undertone implying that the struggle is far from over, and that they'll be more shit to come in the future as well as dealing with the past (which is always proved in the next book). Yet despite this, is seems mostly optimistic in it's ending.
The ending of the first book (GONE) has the survivors of Perdido Beach celebrating with a thanksgiving feast and a jokey subtext from the characters, but also mourning all the lives lost from Caine and co's reign of terror and leaving the future uncertain and worrisome.
At the end of HUNGER (book 2) Sam has defeated the Gaiaphage (or so it would seem), but at a nasty cost of Duck's life. Despite this, there is also the upside that they have found a way to harvest vegetables and avert starvation, so it's a mixed victory... But on the downside; Brittney Donegal ends badly.
LIES has the new villain destroyed and everything seemingly back to normal, but trauma still ensues for the prominent characters and they don't seem particularly happy at the end. To put it delicately. Then again, the children were saved, and it seems that Caine and Diana have finally come to terms with their relationship issues...Although it actually only gets worse from there.
Everything seems to be looking up at the end of PLAGUE, with the villains and heroes coming to a peace truce and a new source of water being found to avert dehydration, but then Diana announces she's pregnant with a demon baby and leaving Caine. Also, Astrid's AWOL and possibly dead for all they know. Making it not without its upsides, but...
FEAR has most of the character's seemingly happy and relieved at the end not that the barrier is no longer black (and transparent, which is a bittersweet revelation in itself), and Sam admitting he has come to accept and maybe even love the FAYZ. Astrid is back, and has sorted out her relationship with the hero, and the dictatorship in Perdido Beach has been seemingly vanquished. But then the main threat is still out there and stronger than ever, and Diana (who serves as a anti-hero in this book) is possibly insane/suicidal and there's still a little bit of sadness to the fact that Astrid doesn't even recognise or care about her parents anymore. It's all open to interpretation whether the end was surprisingly cheerful and perhaps too conveniently cheerful, or whether it's actually the saddest ending as you know that the Perdido Beach kids will never really be the same, and even if the barrier eventually comes down, life will be far from normal to them.
LIGHT has the main threat killed and the barrier come down, freeing the kids trapped inside. But only a little more than half the kids in the FAYZ actually survive, and they're highly traumatized. The lead characters do end up in a better situation, however: Sam's emancipated and living on his own with Astrid, who's now rich due to her movie deal; Diana, despite losing Caine is living with them; Lana and Quinn's lives return to normal quickly; Edilio is still living in the U.S., is openly gay and has Roger; and Dekka's parents don't harass her about her sexuality and she pays tribute to Brianna.
The ending of the series was bittersweet for Dekka and Diana in particular. Both lose the love of their life in highly painful and sudden ways, but they also both find solace in their friends and are implied to go on to live long, happy lives. Diana is implied to be starting a relationship with Quinn, though she's still shook up about Caine's death. But, she also receives a letter from Caine apologising for all the things he did to her and that he loves her, which made me both "laugh and cry", which is bittersweet in itself. Dekka is left utterly alone on the other hand, but is also hailed as a national hero. Those two probably defined the term "bittersweet" the very best out of all the survivors.
Sinclair Lewis' It Can't Happen Here ends on a bittersweet note. Doremus returns to America to encourage dissidents, thereby playing a vital role in the resistance against the government. However, he's constantly on the move to evade Corpos and unable to see his loved ones. Even in a best case scenario, it will likely be years before he can see Lorinda and Sissy again.
The ending to Charlotte's Web, although not without some happiness, left many readers in tears — while Charlotte successfully saves Wilbur's life by writing positive messages about him in her web to convince Zuckerman not to kill him, she consequently dies in the penultimate chapter (to make things even sadder, she dies all alone).
Song at Dawn: For Dragonetz, his paper mill is burned down and because he bought the land with a loan he losses the land and is bankrupt. The only way he can avoid poverty is to undertake a dangerous quest for his debtor, Ravaad, that separates him from Estela. On the other hand, he's no longer in the Arch Bishop's crosshairs, all the paper he's produced had been shipped off before the burning and his reward for the dangerous quest will be the value of the land with the mill on it. If his shippments come back he'll be a wealthy man. As for Estela, she is on her way to the court of her adoring student as a guest of honor and will continue her sterling career as a troubador but she will be apart from her true love and her first original song is about the death of a dear friend.
Legacy of the Dragokin: This ending is significantly less happy than Trapped on Draconica: while the vilains are defeated, Zarracka reformed, Kalak/Daniar reconcilation, and Benji gaining dragokin powers and a possible girlfriend in the future, there is a lot more death, a lot more destruction, the underlying problem (Drewghaven's bad economy) is entirely unresolved, and Man in Shadow got exactly what he needed from the mess and so is one step closer to completing his own Evil Plan.
The Hunger Games: On the good side, the war is over, Panem's tyranny has been defeated, and Katniss and Peeta get to live happily ever after together. On the other side, nearly everyone except Katniss, Peeta, Gale, Haymitch, Katniss and Prim's mother, Beetee, Johanna, Annie, Enobaria, Plutarch, and Paylor is dead, and it's implied that the world will fall back into tyranny soon.
The Chathrand Voyages: The Swarm of Night is prevented from destroying the world, the Shaggat Ness and Arunis are dead and Arunis' sister Macadra is a Sealed Evil in a Can. The Nilstone has been sent out of the world, the corrupt Arquali emperor has been toppled and replaced with a more enlightened regime, and his spymaster Sandor Ott has been driven from power. But the titular ship is destroyed, lots of good people are dead, maybe including Thasha and Pazel has been magically erased from the memory of almost all his friends in the process. Oh, and the Shaggat's millitant cult survived, though it splintered between various factions. The world of Alifros is certainly left in better shape than when the series started, but there's still too much going on to make for a truly happy ending.
Infernal Devices: Jem lives, but as a Silent Brother who can only see Will and Tessa occasionally over the next few decades. Will and Tessa get married, but Will dies in the epilogue, leaving Tessa alone. Tessa leaves her children, not wanting to watch them die too. Jem is cured and he and Tessa get together, but Tessa will eventually have to watch him die too.
Margin Play: The main bad guy loses —big time— in the end, and there's reason to believe that the rest of the bad guys will also be caught, but Mrs Kitsmiller may still lose her house, and even if she doesn't, her neighborhood is still destroyed; dozens, perhaps hundreds, of other people have still lost their homes because of the scheme. Amber gets out from under the loans that were crushing her business, but she also has to face the fact that she did some things that put her into seriously grey territory morally and over the line legally; Amber and Drake realize that they care about each other a great deal, but Drake has to leave when Halcourt's PI shows up to serve him with papers for yet another lawsuit
Can't Get There From Here: The homeless gang splits up. Tears and Maggot are reunited with their families, but Rainbow, 2Moro, OG, Pest, and Country Club are dead, and Jewel's fate is left up in the air. Maybe's fate is more ambivalent; she is given the option of going to a homeless shelter, but it is left unclear if she actually does. At least it ends better than one of Todd Strasser's other novels, Boot Camp.
The Power of Five: The final book, "Oblivion", ends like this: the Old Ones have finally been defeated for good, but half the world's population has been wiped out in the process, including Matt and Scott, and it'll probably take humanity a long time to recover from the destruction the Old Ones caused. All Five Gatekeepers decide to leave the world behind for the dream world.
Swedish writer Simona Ahrnstedt seems to give us a happy ending in her debut novel Överenskommelser. The three main couples obviously will have long happy marriages. Out of the three awful villains, one is dead and the other two get some deserved come-upance. That sounds all fair and good, right? But all this doesn't happen until after Beatrice, the poor female lead, has suffered five years of abuse from her tyrannical uncle. And he also bullied his young niece into a marriage with a man, who was like forty years older than her and treated women like they were dirt under his shoes. We later find out that he had murdered one previous wife and driven another previous wife into suicide. And he also managed to brutally rape and batter Beatrice before he suddenly died! Let's just hope that it was a really painful death... And we also have a subplot about Beatrice's sadistic cousin abandoning a fourteen-year-old girl, whom he made pregnant without caring about her anymore. She decides to have an abortion, a decision that leads to her death... Yeah, she only was a really minor character, who hardly got any screen time. But still, yikes! So in the end, too much have happened for a truely happy ending to be possible...
Those That Wake ends with this. The building and Man In Suit have been taken down, his influence is less widespread, and Tommy and Annie have been rescued, but Mike, Brath, and Isabel are dead, Remak's whereabouts are unknown, no one remembers Laura or Mal, and the corporations are constructing a new building where the old one was—though this one is visible at least. Also, the sequel reveals a new villain is around afterwards.
The sequel to Those That Wake called What We Become. The Old Man has been defeated and the world is free of his influence, and seems to be on the road to recovery, but Remak and Mal are dead.
Fort Hope. Sure, all of the main characters survived, but Greg was forced to kill his love interest's father; she watched him do so, and that's generally a pretty tough thing for new relationships to survive. His cousin, Jess, who was savagely beaten at one point by the man Greg killed, has just broken up with her first love.
Natalie Mooshabr's Mice, especially considering that the novel is set in dystopia of the Crapsack World type. It's a susprise the ending is not a total downer, but it still feels more bitter than sweet, perhaps because the whole tone of the book is disturbing and creepy. The rightful and beloved ruler Duchess Augusta is asked to come back to her palace and oppressed people now might hope for a better, brighter future. Duchess Augusta pardons several evil people who were sentenced to death for their crimes by the new regime, but she poisons herself.
By the end of Legacy The Tale Of The American Eagle, rogue hero American Eagle has caused significant damage to international drug trade to avenge his sidekick, but it’s implied the Snakehead organisation can rebuild faster than the good guys anticipated, and for all his efforts he is being disowned by the United States of America, forcing him to live on the run.
The Maze Runner Trilogy. And how. By the end of The Death Cure, Newt and Teresa are dead, there's no cure for the Flare and the Immune will inherit the Earth. Thomas, Minho, Brenda, Jorge and the 200 Immunes begin rebuilding civilization in a safe place far from the Scorch.
Giselle transfers Baltair into his egg so she'll no longer feel his presence in her mind, but she will still be his flyer and neither of them will die from Soul Pains.
Corran is captured by Ikjorians and seemingly abandoned by Frang, but since Frang is out of him he will won't die of Soul Pains. Also, he's matured enough to step out of his family's shadow and confront his problems on his own terms.
Idlewild: Halloween survives long enough to get out of virtual reality and kill the Big Bad. This does not help cure Black Ep, or resurrect the entirely dead population of Earth, nor does it help rebuild civilization as a whole.
Edenborn: Halloween and Isaac rejoin the other survivors to research Black Ep as a group with a likely end in sight. Their children Deuce, Rashid, Mu'Tazz, Hessa, Haji, and Dalilah are dead or dying.
The Wandering by Roger Elwood: Neshi and his two companions from Nede are all killed on the last world they ended up on, but just as Neshi dies, he could hear the voice of his wife Etarina calling "Baba". This is after they discover the truth that they were seeking: Jesus Saves.
At the end of Take Back the Skies, the government has been taken down, the Collections have ended, and the day is saved, but Fox is dead, most of the children are unable to return to their parents, and Cat is forced to marry Prince James to ensure Angyla is restored to its former stability.