Subverted in Anna Karenina—the title character has gotten pregnant from her adulterous lover, Vronsky, and seems fated for Death by Childbirth, so she calls back her husband in order to obtain his forgiveness before she dies. He grants it, Vronsky leaves...and Anna survives. Given the choice of staying with her husband and resuming her old life, she instead runs off with Vronsky, apparently having learned nothing, and more tragedy comes to follow from this decision.
In The Courts of the Morning, the heroes go to a lot of effort to help the Diabolical Mastermind to a HeelFace Turn, figuring that he's not positively evil, just twisted by a cynical and friendless privileged upbringing, and is capable of being as great a force for good as he is for evil. It works, and as the book reaches its close, he's looking forward to a new future and the good he can do for the world and his new friends — and then in the last chapter he's murdered by a vengeful former henchman who escaped the round-up of his old criminal organization.
House of the Scorpion: Tam Lin invokes this trope on himself as a form of penance for accidentally killing twenty school children in a bomb plot gone awry.
Severus Snape. He spent his entire life trying to make up for unknowingly betraying Lily Potter, the love of his life, to Voldemort. He ends up giving Harry Potter just the information the boy needs to finally take down Voldemort. And then dies.
Wormtail, though his death was case of Doubt Equals Death along with Hoist by His Own Petard. When he refrains from killing Harry, his silver hand promptly chokes him to death.
Also subverted with Voldemort. It's stated that if he took back all his horcruxes, by feeling real remorse, then its fairly certain he would have died in the process. And it probably wouldn't have been very lovely. Of course, he is too far gone for that and has to be killed without redemption.
Regulus Black chose to defect from the Death Eaters and died while trying to destroy one of Voldemort's horcruxes. The attempt failed and actually made things worse in the long run, but at least he died proving that his heart was the same as his brother's.
And Gellert Grindelwald, who lies to Voldemort about the Elder Wand. Like Regulus, it amounts to nothing, considering that Voldemort figures out the wand's location on his own, but at least it's shown that Grindelwald feels some remorse for his deeds.
To some degree, this happens with Rufus Scrimgeour, even if he wasn't one of the bad guys. All throughout Half-Blood Prince and Deathly Hallows, he's trying to get Harry to be a Ministry poster boy, even though Harry disagrees adamantly. When Scrimgeour goes down in a fight against the Death Eaters, defending the Ministry, and refuses to betray Harry to Voldemort, right to his face, the trio grows to respect his bravery more.
Subverted with Percy Weasley. For three books, he sides with the Ministry against his family and the Order and only changes sides during the final battle. He helps Fred fight Death Eaters as the narrative suggests that he will die protecting his younger brother. A few pages later, Fred dies.
Nevva Winter (Gee, sound familiar?) from the Pendragon series was a Traveler gone wrong; she turns into an emotionless Manipulative Bitch. However, thanks to her mother, Bobby, and his friend, she turns into a good guy— just to be killed by the person she'd turned "evil" (depends on your view of her) for, Saint Dane.
Everworld's Christopher Hitchcock has no Genre Blindness, so he had an internal monologue to this effect in book 11. "I was so dead. By all the Unwritten Rules of Movies and Television, I was dead: The reformed bad boy who does the heroic thing at last? I could not be more dead."
Dates back to Victorian times: If a woman had sex outside of marriage or in adultery, the only accepted redemption for her was death. The very rare plays that dared to challenge this sexual Double Standard, such as W. S. Gilbert's Charity, were declared immoral.
Averted in Nathaniel Hawthorne's The Scarlet Letter, where the married Hester Prynne sleeps with the Reverend Arthur Dimmesdale, whose sin is considered worse than hers because of his position, so he dies instead, and she redeems herself through general good works.
Also, Hester couldn't hide her adultery because of an ill-timed pregnancy. She faced up to her punishment, and started to redeem herself. Dimmesdale continued to live in the community's good graces while Hester was shunned, and only fessed up when he couldn't take the guilt anymore. It's possible that his part of the adultery was worse, but hiding it didn't get him any redemption points either.
And once more—the strange thing about The Scarlet Letter is that the whole novel up to the point of Dimmesdale's death reads as a subversion of this trope. But this is the Victorian era, so of course, someone must die for the adultery.
Also averted in Jane Austen's Pride and Prejudice, where Lydia Bennet gets to marry Wickham instead. Some scholars see her treatment as progressive, where similar behavior in other novels would have resulted in death.
Victorians also averted this trope by shipping "fallen women" overseas. Charles Dickens does this in David Copperfield (Emily and Martha head off to Australia, along with several other characters). Though he played it straight with Nancy in Oliver Twist...
To an extent, Sidney Carton's death in A Tale of Two Cities counts. Although not a sinful man, Sidney spent much of the story as a useless, inactive character with low self-esteem. Then, he takes steps to rescue Lucy and Charles, eventually dying.
Boromir: Though never a villain, he did screw up enormously, briefly became The Atoner, and then got mercilessly slaughtered.
Théoden nearly allowed Rohan to fall by trusting Gríma, but rose and proved critical in victories at Helm's Deep and the Pelennor Fields, where he died a hero's death. "I go to my fathers. And even in their mighty company I shall not now be ashamed."
In Foucault's Pendulum, Diotallevi rejects the Plan and dies of cancer shortly thereafter. Jacopo Belbo refuses to tell the horde of Diabolicals where the Map is, or even reveal that the whole story of the Map is a lie... and is then hanged. On a pendulum.
The Thursday Next series does this twice: first, Cindy Stoker in Something Rottenliterally takes Thursday's place crossing the Styx, saying that Thursday is a better person than she will ever be, and more deserving of a second chance. In First Among Sequels Evil Thursday uses her final moments to help Thursday to safety, knowing that she herself cannot escape.
Subverted in Fred Saberhagen's Third Book of Swords. Yambu, the Silver Queen, who was the antagonist of the first book, joins forces with the heroes to stop the even worse villain Vilkata, the Dark King, who possesses the Mindsword. In the final battle, she draws Soulcutter, which neutralizes the power of the Mindsword, but which also appears to kill her. But it turns out she survives after all, although she is prematurely aged as a result; she then gives up her throne and spends the rest of the follow-up series on a pilgrimage with Prince Zoltan to find redemption the old-fashioned way.
In Gav Thorpe's Warhammer 40,000Last Chancer novel Annihilation Squad, at the very end, Kage is freed from a daemon's control, manages, with great effort, to remember what had happened while he was controlled, and realizes the value of sacrifice. He immediately drags the man they had come to assassinate over the cliff.
In Kushiel's Dart, Isidore d'Aiglemort goes on a suicide mission to avoid being remembered as a traitor (and foil the plans of The Chessmaster, Melisande).
In James Swallow's Warhammer 40,000Deus Encarmine, when taxed with the Word Bearers still in their midst, and they can't tell the Blood Angels where they are, the people of the planet voluntarily, even ecstatically, submit to death as punishment.
In Peter David's Star Trek: New Frontier novel Treason, Dr. Selar dies in an explosion that saves other characters' lives—making up for the rest of the novel, in which she goes temporarily insane, contemplates murdering one of her patients, continues destroying her relationship with Burgoyne 172, kidnaps a former crewmate's newborn son, and various other things of like ilk.
In the novel Cat Among the Pigeonsone of the murderers redeems herself by taking a bullet to stop her best friend being killed and thus atoning for her own murder.
Another Agatha Christie example is Mrs Lorrimer from Cards on the Table, who, the night before being murdered, attempts to turn herself in for the murder of Mr Shaitana, both to protect another suspect and to atone for having gotten away with murdering her husband years earlier.
Perhaps the ultimate example comes in Curtain, when Poirot kills Norton, the orchestrator of all the previous murderers, he then casts aside his nitroglycerin pills for his heart, leaving his physical and eternal fate to God.
In Myst: The Book of Ti'ana,Veovis, who has been manipulated by A'gaeris into helping him destroy D'ni, refuses to let A'gaeris set himself up as a god. A'gaeris then backstabs him. As he is dying, Aitrus finds him. He repents of his evils and gives Aitrus the way to save his family, then dies.
The fate of Commander Gaes in The Lost Fleet who had been opposed to Geary's methods of running the fleet and latter mutinied with Captain Falco. The carnage Falco led her through followed by Geary's rescue led her to have a change of heart and she latter warned him of an attempt on his life by Captain Kila. When it became clear Gaes was no longer cooperating, the next attempt on Geary's life included a successful one on hers.
In Annals of the Black Company, may or may not be averted by The Lady. Knowing what the outcome will be, she chooses to accept the loss of her powers rather than allow an even bigger evil than herself to be unleashed on the world. On the other hand, her powers had allowed her to maintain her youth and beauty indefinitely; it is strongly hinted that without them she will die eventually. So this could be seen as a very delayed form of Redemption Equals Death.
In the Dale Brown novel Plan of Attack, Russian chief of staff General Nikolai Stepashin had planned the nuclear sneak bombings on the US. He later gives away the position of General Gryzlov's alternate command centre, where they are both hiding in, to the Air Battle Force. He dies when the man finds out and kills him.
This is how Kronos is killed in the Percy Jackson and the Olympians series. Luke remembers his promise to keep Annabeth safe, and realizes that he's come very, very close to killing her, so he fights against Kronos, takes Annabeth's knife from Percy, and kills himself with it, killing Kronos in the process.
Silena Beauregard was killed after taking her best friend's armor and leading the Ares cabin into battle, trying to make up for the fact that she was The Mole the entire time.
Ethan Nakamura is killed after realizing that Kronos only wants to destroy everything, not make things more equal for minor gods/goddesses like Ethan's mother.
In Farworld, Land keep, Rhaidnan betrays his friends Kyja and Marcus to the Zentan. One chapter later, after being berated by his family, he takes a flaming dagger to the chest to save Kyja- saying as he bursts into flames
" tell Char I didn't disappoint. Made...children...proud"
The character of A.J. Raffles, upper-middle-class gentleman-thief created by E.W. Hornung, volunteered with his sidekick Bunny for service in the Boer War after his exposure; Raffles is killed, Bunny is wounded. In the words of George Orwell, it was Raffles' only acceptable way out. "A duke who has served a prison sentence is still a duke, whereas a mere man about town, if once disgraced, ceases to be "about town" for evermore.... According to the public-school code there is only one means of rehabilitation: death in battle. Raffles dies fighting against the Boers (a practised reader would foresee this from the start), and in the eyes of both Bunny and his creator this cancels his crimes."
In the novel Death Star, the Imperial chief gunner for the station, Tenn Graneet, feels utterly sickened with himself for destroying Alderaan since he was the one in charge of the superlaser. He can't get over the guilt of being the man that pulled the trigger and killed two billion people. So when Luke is racing for the exhaust port and he is ordered to destroy Yavin IV, Tenn has his hand on the lever and is ready to pull it—but, praying for a miracle, he holds off executing the order for as long as he can get away with it. (In the film, he's the one who keeps repeating, "Stand by... stand by...") And his prayer is answered as Luke fires the torpedo that destroys the Death Star, not only saving Yavin IV but unknowingly granting Tenn death and redemption.
In Razor's Edge, Captain Metara, an Alderaanian who has turned to piracy, is starting to come around to Leia's way of thinking, and is certainly feeling personal loyalty to Alderaan's princess. She probably could have been convinced to join the Rebellion, except that she dies saving Leia. The other Alderaanians, inspired by her sacrifice, do come around in the end.
The ancient Irish story of Lugh and the Sons of Tuireann. In it, the sons kill Lugh's father and in response, Lugh sends them on a massive and nigh impossible fetch quest. Naturally they succeed, but all three are mortally wounded during the last task. They have just enough time to return to Lugh and show them that they have atoned before they all die.
Sextus, son of the last Roman king Tarquinius Superbus had raped one Roman woman, Lucretia, who was well known for her beauty and goodness. Now at this time raped women were seen as damaged goods. And additionally, there was mistrust around: Would they believe her, or claim she was lying? The solution for her dilemma: She confessed being raped to her relatives and killed herself afterwards. So, nobody could claim that her example would set a bad precedent for women randomly accusing men of being rapists. Her male relatives went on and kicked the king out, starting The Roman Republic.
In one instance in a hadithnote A saying or event ascribed to Muhammad, and used to better interpret the Quran, there was a woman who came to him, saying she had become pregnant from adultery, and that she wished to be purified. He told her to come back after she had the baby, which she did, again requesting purification. He told her to come back after she had weaned her baby. She did, even feeding her toddler a piece of bread to prove that the child had, in fact, been weaned. He then condemned her to be stoned to death, the ordinary punishment for adultery.
In Death series: Poor Mick Connolley from Betrayal in Death. He helped to distract Roarke long enough for a group of criminals to pull off a heist at a big auction. Roarke did figure it out beforehand, and got his old friend Connolley to explain everything. Mick didn't feel bad about what he did...until he found out from Roarke that the criminals tried to distract Roarke by having a hitman kill off two employees, and try to kill off Summerset. Mick doesn't have a problem with stealing, but he does have a problem with being a party to murder. He did attempt to make amends, and it cost him his life.
Ebenezer Saint in The Inventors and the City of Stolen Souls dies (for the second time, thanks to a robot body) taking over the megalomaniac computer that was the book's final villain and making a Heroic Sacrifice to take it with him, admittedly after a brief attempt to take over the computer and the world with it. In the previous book, he'd been working on a plan straight out of the James Bond villain playbook to obliterate the surface with nukes, then build his own "perfect world".
Averted and subverted in The Aftermath by Ben Bova. The book starts off with a mercenary leader destroying a colony full of defenseless civilians. He afterwards tries to commit suicide, is brought back as a cyborg, and spends most of the rest of the novel trying to atone by giving final rites to the victims of old space battles lost in space. He tries to get himself killed repeatedly but fails, and survives through the end of the book finally achieving redemption and a will to go on living
Denna of the Sword of Truth. In a surprisingly heartbreaking way to end a gratuitous S&M sequence.
In the Star Trek novel A Time to Heal, Erokene Yaelon is a military leader on planet Tezwa, and a supporter of power-mad prime minister Kinchawn - at least at first. After Kinchawn's Drunk with Power outrages lead to a brutal Klingon counterstrike that kills Yaelon's family (among many others), he loses faith in his leader. Eventually, he earns a degree of redemption for his earlier support by helping Commander Riker escape captivity, at the cost of his own life.
Zigzagged in The Painter Knight when a child sovereign declines to condemn the repentant traitor and orders him to return for sentencing after she's of age, knowing he's mortally ill and won't live that long.
Les Misérables combines this with To Be Lawful or Good and Take a Third Option. Inspector Javert, who has spent his life believing dogmatically that Law = Good and law-breakers are evil forever, tries again and again to arrest Valjean, who was a petty crook but redeemed himself into a paragon of selfless goodness. When Javert is caught undercover behind the barricade, Valjean volunteers to execute him... and promptly lets him go, telling him Valjean's home address so that Javert may arrest him afterwards. This proves Javert's entire mindset wrong, and throws him into a tailspin: he can arrest Valjean and uphold the law, or let him go and repay the life-debt, mutually exclusive actions that would put him at odds either with his vocation or with God. He avoids having to make the decision by throwing himself off a bridge.
The Power of Five: After betraying the other Gatekeepers to the Old Ones, Scott regrets his actions and sacrifices himself to open the portal at Antarctica after it was sealed by the Old Ones, allowing Pedro and Jaime to reach the other Gatekeepers and put a stop to the Old Ones.
In the Warhammer 40,000 book, Deathwatch, Captain Higgan Dozois was "in the eyes of many, a worthless, lecherous, drug-dealing rogue" and near the end of his life, his ship was commandeered by two Genestealers and a hybrid human that demanded passage to the planet Melnos. The hybrid demanded that they warp away from the current planet immediately to escape Imperial starships. Knowing that he would be branded a traitor by history if he did so, he instead set his warp engines to overload, killing his men and the alien threat to Melnos. This action saved the 64 million inhabitants of that planet. This was all despite the fact that he had no idea what the Genestealers even were and despite the fact that they promised to spare his life (implying that they would implant him).
Alexis Carew: Into the Dark: Alan sexually assaults Alexis while drunk, but she fights him off, then, not wanting to see him hanged, lies to the bosun and the captain that his injuries were sustained in a fall. Alan stops drinking altogether, then way later, he fakes going over to Space Pirates to keep them from killing her and the other members of the prize crew on a captured pinnace, and is fatally shot helping them retake the ship.
Discussed in The Dagger and the Coin. Geder ends up sacrificing himself to destroy the Path of Inspiration he helped bring to power after realizing how the cult had been using him. The heroes explicitly discuss whether or not he achieved any measure of redemption for his crimes as Lord Regent by doing so; Marcus doesn't buy it, while Cithrin is more ambivalent.
Reunion: The Jewish protagonist Hans escapes Nazi Germany before the purges begin, leaving behind his classmate and only friend Conrad von Hohenfels, a minor aristocrat who buys into most of their rhetoric. Years later, Hans returns to Germany to see his town has been leveled. The school asks for funds to build a memorial to former students, including a list of their names along with their fates. Hans understandably has some difficulty in getting himself to read the H page...
Conrad von Hohenfels. Participated in the plot against Hitler. Executed.
City of Bones by Martha Wells: Riathen ignores the main characters' warning and activates the Ancient artifact, but once he realizes how nasty the entities it's summoning are, he throws all his power into creating a barrier that prevents them from fully entering the human world, killing himself in the effort.