Queen Solina from Dragonlore. She spent all of her time slaughtering as many Vir Requis as possible as punishment for the amount of mistreatment she was subjected to by them growing up, not to mention that they killed her parents and banished her. It isn't until the final book where she realizes that she's just a sad woman who was blinded by her hatred, when all she truly wanted was to be with Elethor, her true love. Her final words really hammer it in.
Solina: "I'm sorry. I'm sorry for how much I hurt you. All I wanted was to be with you here. I'm sorry."
Prince Leresy Cadigus from The Dragon War was a pitifulHate Sinkwho acted very haughty and believed he "deserved" everything he asked for, when he never earned it. He even put Rune and Tilla at risk in a desperate attempt to win his father's love again. When that fails, he lashes out at his father and brutally kills him, thus saving Rune and his sister Kaelyn and ending the trilogy's civil war. Shame he took a bullet in the process.
Severus Snape. The subsequent chapter reveals that (despite his faults) he's not actually a villain. But Harry and the reader would have still assumed he was at this point, and it's still a sad scene.
Barty Crouch, Jr. Sure, he became a death eater, but all he ever wanted was a loving father. Some fans thought that when he received the dementor's kiss, that his punishment was not only going too far, but also very sad, considering how neglected he was by his own father.
Peter Pettigrew may be the most disgusting and loathsome character with no excuses, but you feel a bit bad that his own hand strangles him to death because of his one moment of mercy for Harry.
Though the Revenge of the Sith novelization makes clear that Count Dooku is The Sociopath, you can't help but feel for him when seconds from death, he realizes everything he has done or accomplished, all his talent and power and intellect, has been used by Sidious to fulfill his plans with no regard for Dooku's wishes. Even worse, he realizes Sidious had always planned to kill and replace him. "Treachery is the way of the Sith."
Martel's death in David Eddings' The Elenium fits the bill. After three books of playing Worthy Opponent to Sparhawk, he admits he knew Sparhawk was better all along, and both Sparhawk and Sephrenia forgive him and give him their blessings. Just for a minute, the guy who betrayed the entire Pandion Order goes back to being Sparhawk's brother in arms again.
Martel: You always said I'd come to a bad end, little mother, but you were wrong. This isn't so bad at all. It's almost like a formal deathbed. I get to depart in the presence of the only two people I've ever really loved. Will you bless me, little mother?
Zedar's fate in The Belgariad makes one almost feel sorry for the guy. Sealed up in the ground, forever? Yeesh. Worse when you consider that his FaceHeel Turn was a result of being forcibly turned by the Big Bad while trying to be the mole.
Turned Up to Eleven in Belgarath The Sorceror when Belgarath as narrator almost casually notes that Zedar was always afraid of the dark.
The same could be said for Asharak, a high-ranking servant of Torak and manipulative bastard who messed with Garion for years, whose awful death will likely haunt Garion for the rest of his life.
There's a retroactive example in The Malloreon. Taur Urgas, King of Cthol Murgos was a frothing madman, and was played as such in the The Belgariad. In The Malloreon he comes off even worse as it comes out what life in his home was like for his children. Garion notes when talking about the terminally-depressed 'Zakath that he would much rather be fighting Taur Urgas ("now there was a man I could cheerfully have gone to war with. He polluted the world just by living in it.") And then Eriond points out that "he was insane, Garion, and that's not his fault." At that point, all of Urgit's comments about his father's fits of madness and irrationality come back to you in a whole different light, as you realise that the man was genuinely clinically insane, and not merely Ax-Crazy, and never got any help for it.
Warrior Cats has a tendency to do this with most of its villains, due to its Grey and Gray Morality policy. Tigerstar, at least in the first series. Firestar notes afterwards that he could have been a great and noble warrior if he hadn't let ambition control him. The truly horrible death he suffered: being ripped open, and subsequently bleeding to death NINE TIMES.
From Codex Alera, for all the horror she had caused, all the death and the near destruction of the world, the Vord Queen seems, in the end, to be a sad, lonely child seeking the approval of her father.
Cao Cao gets a long poem on his death, daring anyone to criticize him.
Smug Snake Yuan Shu dies as a result of some mixture of illness, starvation, and dehydration, all the result of his last botched campaign. His last words are a request for a little honey water for his throat, to which his chef replies that there is no water in the camp, save that which is tainted by blood.
Ineluki, the Big Bad himself, is revealed to have committed all the atrocities in his life out of love for his people and a desperate desire to lead them to salvation. In the end, this realization leads directly to his defeat.
Binabik looked at him curiously. The innocent can be molded, as those children were, but sometimes luck is granting that they can be molded back. I have little belief in evil beyond redeeming, Sludig. Oh? The Rimmersman laughed harshly. What about your Storm King? What good thing could you possibly say about such a black-hearted hellspawn as that? Once he loved his people more than his own life, Binabik said quietly.
Utuk'ku, the Norn Queen and The Chessmaster behind Ineluki's rise, is broken by the failure of the Evil Plan, and is left as nothing more than what she always feared to become: a frail old woman.
A short story has Tanis and Flint kill a Black Mage who's been sucking the life out of people. After he's dead, they find out that he was doing it to prolong the life of his sickly son.
Test of the Twins: the Archmage Raistlin Majere attempted to become a god by dethroning one of the current ones. He manipulated everyone around him, abandoning or killing them as soon as they stopped being useful, and, as shown in an alternate would, have not only succeeding but have DESTROYED every other god in the pantheon, leaving him sole ruler of the universe. However, he sacrificed himself to save his time-traveling brother, ex-friend, and one of the people he manipulated, because they showed him that he would destroy the world in the process of attaining godhood.
Several villainous characters by John C. Wright are pitiable when they die:
War of the Dreaming: Angelo Casselo, who knows he's nothing but a pawn in the game; and Manannan, alias Tom, a What Measure Is a Non-Human? who had been desperately playing both sides in an attempt to prevent his people being annihilated.
Luke tries to kill the heroes multiple times and tries to help the Big Bad, Kronos, rise again (eventually hosting him in his own body). In the final chapters of The Last Olympian, he sees Annabeth bleeding, breaks free from Kronos's mind control, and realizes that he was fighting for the wrong side. He then kills himself to destroy Kronos, and it is indicated that he goes to Elysium in the afterlife.
Ethan Nakamura fights in a battle to the death against Percy, and when Percy wins, he refuses to kill Ethan. Ethan repays him for this by betraying him and pledging himself to Kronos, enabling Kronos to rise again. Throughout "The Last Olympian", he is seen working for the Titans. Then, Percy convinces him to turn against Luke/Kronos, who kills him, earning him sympathy in the end.
Silena Beauregard originally seems like a gentle, romantic daughter of Aphrodite. However, she is secretly a spy for Luke, and the information she has reported has lead to the deaths of many campers. When Kronos and his minions become responsible for the death of her boyfriend, she begins to think twice about her actions and eventually disguises herself as Clarisse, rallies the absentee Ares campers, and charges a Drakon, resulting in her death. Her secret - that she was the spy - comes out as she is dying, but the other campers remember her as a hero anyway.
The Phantom of the Opera — Erik's death has this effect both on readers and on his fellow characters. Him being born disfigured and never being given a chance to live like a normal person, which was what he desired the most, led him to use his charisma and talents for evil because only there did he find acceptance and by the end he died happy that found at least some affection from Christine.
In City of Heavenly Fire, Sebastian Morgenstern goes down quickly, but Jonathan, the good within him, arises, tells Clary how to destroy the Infernal Cup, talks about what might have been, and then dies.
Olivia closed her eyes. This was no longer battle, but butchery, frantic, bloody, impelled by a hysteria of fury and hate, in which culminated the sufferings of battle, massacre, torture, and fear-ridden, thirst-maddened, hunger-haunted flight. Though Olivia knew that Shah Amurath deserved no mercy or pity from any living creature, yet she closed her eyes and pressed her hands over her ears, to shut out the sight of that dripping sword that rose and fell with the sound of a butcher's cleaver, and the gurgling cries that dwindled away and ceased.
In Dracula, Renfield's death invokes this trope. He's mostly unsympathetic for most of the novel—he nearly beats a man to death and attacks one of the protagonists with a knife—but when he realizes that Dracula had lied to him, he attempts to defend Mina Harker from him and is fatally injured because of it. The graphic description of his injuries doesn't help.
In Skulduggery Pleasant: Mortal Coil, the death of the Russian assassin Tesseract. After being fatally injured by Lord Vile, Tesseract removes his mask and asks Skulduggery to help him get outside so that he can feel the sun on his face one last time. As they go, he talks about how he'll miss his cat, and how he has no regrets.
"I have a cat, you know. Back home. [...] She doesn't have a name. She is just Cat. She curls up on my chest whenever I sit down, and goes to sleep. I hope she doesn't miss me. I'm going to miss her."
Mandrake is introduced in Duncton Wood three chapters in as a bloodthirsty, giant mole that later becomes an iron-fisted dictator. Then, in a quick moment of Rebecca's life, he scolds her for enjoying the snow and, after that, delivers a speech against the snow that's quite poignant considering his story. And when he finally dies, he does so half-mad from wandering the Ancient System for months alone, crying for his only daughter while being mercilessly beaten down by a revengeful Stonecrop.
Sly Moorcock from Stark by Ben Elton is a ruthless billionaire who has no qualms about leaving Earth with the other billionaires and letting humanity die in the inevitable ecological breakdown. Yet he moves more and more into Anti-Villain territory as the story progresses, and shows himself in possession of both moral standards and the capacity to love, and when he commits suicide in the epilogue by throwing himself out of an airlock, it is just as sad as when one of the good guys die.
'Wait,' she said, her voice weak and somehow very young. She didn't look like a mad faerie sorceress now. She looked like a frightened girl. 'Wait. You don't understand. I just wanted it to stop. Wanted the hurting to stop.' I smoothed a bloodied lock of hair from her eyes and felt very tired as I said, 'The only people who never hurt are dead.' The light died out of her eyes, her breath slowing. She whispered, barely audible, 'I don't understand.' I answered, 'I don't either.' A tear slid from her eye and mixed with the blood. Then she died.
In Good Omens, the demon Duke Ligur is doused in holy water in a booby trap set up by Crowley. He thoroughly deserved it, but for a demon, it's an amazingly horrible way to die, and his partner-in-crime Hastur immediately goes into Villainous Breakdown and attempts a Roaring Rampage of Revenge on Crowley, chasing him down a phone line.
Phoena's death in Fusion Fire was so horrific that Brennen did his best to comfort her in her last moments, despite the fact that not only was she responsible for his capture by the Shuhr, but she also tried to have him and his wife essentially tortured to death.
The third Safehold book, By Heresies Distressed, has this happen with Prince Hektor of Corisande. He's been beaten, he knows it, and he is preparing to negotiate terms of surrender with Emperor Cayleb. Before he can, however, he and his eldest son and heir are victim of an assassination that is blamed on Cayleb. Hektor, in his final moments, realizes that he truly loved his son, who had thus far been The Un-Favourite.
In The Bartimaeus Trilogy, Faquarl achieves the vengeance he's been craving for 5000 years, and discovers that it doesn't bring him the satisfaction he wanted. Then he finds Bartimaeus sharing a body with a human, proving him wrong about the inevitability of conflict between humans and spirits. Bartimaeus narrates that he's never sure if, had he wanted to, Faquarl couldn't have killed them before they shot him.
Faquarl: Your discovery is remarkable. But it comes too late for me.
In Death series: this has happened with some of the murderers after they get caught or killed. Portrait in Death has Eve and Peabody realizing that the murderer they caught wasn't greedy, vicious, or downright evil, just pathetic.
Time Scout's Skeeter Jackson truly feels sorry for what happens to the enraged gladiator who spent the entirety of Wagers of Sin trying to kill Skeeter.
Antrax in The Voyage of the Jerle Shannara was just following its programming. Its reaction as it slowly loses contact with the outside world and shuts down is as sad as it is necessary.
The Aeneid: Most of the antagonists go out rather sadly. The standout may well be Mezentius, Nay-Theist, exiled tyrant, and brutal fighter whose disdain for the gods and vicious rule over his old city-state have brought him to Italy to fight as a mercenary. When his son and Morality Pet Lausus is slain, Mezentius goes ballistic, cutting down opponents left, right, and centre before being stopped by Aeneas; his Famous Last Words, wherein he refuses to pray and asks only that he buried by his son, are quite touching.
Durza, the Shade from Eragon, surprisingly earns sympathy just before his death at the hands of the protagonist. While fighting off the Shade's mental attacks, Eragon accidentally breaks through into his mind and sees a quick succession of images from his early life, before he became a Shade. The man who became Durza was originally a young orphan named Carsaib who was taken in by a sorcerer and instructed in the art. When his master was murdered, the grief-stricken young man called upon powerful spirits to get revenge, but they proved more than he was capable of handling and possessed him. Durza was pure evil, but Carsaib was a tragic figure who made a terrible mistake and paid dearly for it.
Of all the characters who are involved in the Final Solution of Timeline-191 — or at least all of the ones you get to know — only Hipolito Rodriguez is still human and moral enough to have a Heel Realization and repent of what he has done. It's the sincerity of his horror and repentance that evokes sympathy.
In The Stand, the death of Harold Lauder. Presented as a fat, sometimes disgusting social outcast who uses overly purple language at times, is insanely jealous of Frannie Goldsmith, incredibly hateful towards the Free Zone Committee (and Stu Redman in particular, whom he believes stole Frannie from him), pompous, contrary and argumentative, Harold is nonetheless a tragic figure: sadly used by the Big Bad, Randall Flagg, who takes advantage of Harold's weaknesses and literally leaves him to die by the side of the road with his leg shattered. Harold's final statement says it all: "I was misled."
In The Dark Tower there is the death of Trampas, one of the Mooks guarding the Devar-Toi. He works for the Big Bad, but he's actually a pretty decent guy once you get to know him. It's made pretty clear that Ted really doesn't want to kill him and even yells at him to get out of their way, although he is forced to eventually resort to throwing a mind-spear at him, killing Trampas in the process.
Caster having a hallucination of Jeanne d'Arc reaching out to him while smiling and realizing just what kind of monster he has become before dying.
There is also Kayneth's death, based on your definition of "villain" (he did kill Risei). It's hard not to feel a little sorry for him when he gives up the War to ensure the safety of the woman he loves, only to be ruthlessly gunned down together with her.
The gamebook Search for Dinosaurs: A T-rex slowly starving in the aftermath of the meteorite fall is a rather pitiful sight, even if it tried to eat you previously.
Kara no Kyoukai: Overlooking View has Kirie Fujou, who unconsciously uses her spiritual counterpart to drive other girls into suicide out of loneliness. When Ryougi kills her spiritual counterpart, Kirie says that the moment Ryougi killed her was the most she has ever felt alive. Feeling she has nothing to live for and wanting to experience death again, she commits suicide.
There is also Fujino Asagami in Remaining Sense of Pain, although she's mostly an Anti-Villain. She's been raped, her own father has hired Ryougi to kill her, and she's dying a slow, excruciating death via untreated appendicitis. At the end of the chapter, she's crawling through rubble, weakly repeating that she doesn't want to die between bouts of vomiting blood.
Araya Souren in Paradox Spiral. As he lays dying after Ryougi defeats him, Touko questions his obsession with the Spiral of Origin. Araya recalls his past and we see that witnessing endless death and tragedy has left him guilt-ridden over his inability to save the people around him in his years as a wandering Buddhist monk, so he decided to at least record their deaths and desperately attempted to find some form of meaning or purpose in them.
Although the death of Bertha Mason in Jane Eyre leaves Jane and Rochester free to get married, it's hard not to feel for her, especially since her life has been so loveless and painful.
The Lord of the Rings: Loathsome as Grima Wormtongue might have been, it's hard not to pity him when one sees the level to which he has been reduced by the time of his death.
In The Doomspell Trilogy by Cliff Mcnish the death of the first book's main villain Dragwena in the second book is really rather sad. The way she dies is rather horrible as she attempts to revive herself but Came Back Wrong in a Body Horror way. She also dies being cradled by her mother and sister who love her deeply and mourn her death.
Not even an Ax-CrazyJerkass like Cato deserves to be Eaten Alive by Mutts for over twenty hours in The Hunger Games.note Some sort of body armor that Cato most likely got from the feast earlier kept him from being instantly killed.
"She thought, as she looked into his eyes, that he had never been compassionate himself, nor forgiving, nor generous. He had nursed his resentments and hatreds all his life, and had taken his pleasure from acts of malice and revenge. Your life could have been different, Alfred, she thought. You could have been kind to your sister, and forgiven your stepbrother for being cleverer than you. You could have married for love instead of revenge. You could have been loyal to Prior Philip. You could have been happy."
The Da Vinci Code: has Silas who spent all his life being treated as a monster and an outcast for being an albino, so much that the one time that someone showed kindness to him, he ended up joining his religious crusade out of gratefulness. While this led him to commit terrible crimes, by the end he went through a big My God, What Have I Done? moment where he prayed not for his life but for his adopted father's and died hoping to find piece and God's forgiveness in the end.
Renegades: Hawthorne steals medicine and uses it to create deadly drugs, but it's hard not to empathize with her when Frostbite's team "neutralizes" her and then tortures her to death for their own sick amusement.
The Big Bad of the third Alex Rider book, General Sarov, is only doing what he does out of a misguided belief that he is doing what is right for his country, and greatly admires Alex because, even though he is trying to stop his plan, he is also doing what he believes is right. Indeed, he plans to adopt Alex and raise him as his own son. When Alex rejects him and tells him he'd rather be dead than have a father like him, Sarov is Driven to Suicide. This trope is implied in the book, where his death happens offscreen, but it is more apparent in the graphic novel adaptation, where Sarov is visibly distressed by Alex's rejection and sheds a tear as he puts the gun to his head.