Daitokouji-sensei of Yu-Gi-Oh! GX stuck around as a Spirit Advisor. He actually proved to be more trustworthy after his death, since he was a Double Agent while he was still alive.
One of the best-known examples, Roy Focker in Super Dimension Fortress Macross —Hikaru's "sempai" and leader of the elite Skull Squadron aboard the titular ship.
And in one of the sequels, MacrossFrontier, Focker's death is directly referenced when the current Skull Squadron leader, Ozma Lee, all but telegraphs his death all throughout the episode, going as far as the "pineapple salad" (in this case, pineapple cake) that spelled doomed for his predecessor, as well as similar shots and camera angles. He was rushed to the hospital and survived, and the other characters acknowledge how dramatic it would have been if he had died (almost verging on Breaking the Fourth Wall.) Then this trope hits the other mentorinstead...
This trope is quite frequent in Humongous Mecha Anime. Thus:
Mazinger Z: Dr. Kabuto. He got murdered by his rival'shenchmen shortly after completing the titular robot and handing it over to his grandson.
Kotetsu Jeeg: It happened twice with the same person. Professor Shiba got murdered in the first episode. However he got the foresight to make a backup of his personality in a computer in order to help and guide his son Hiroshiand then it commited a Heroic Sacrifice.
With the danger of spoiling just by mentioning the name of the series: Hikaru no Go. Sai does find peace. The series climax is Hikaru learning to move on.
Rurouni Kenshin has the The Ace mentor Hiko Seijuro, master of the sword school Hiten Mitsurugi, who was first abandoned by his student Kenshin Himura. About over a decade after, Kenshin returns to him to learn the ultimate technique of the sword school they both use, which could only be learned by killing the master. Subverted when Kenshin does learn the technique but did not kill his master thanks to his reverse blade sword.
Naruto. So. Damn.. Much. The idea of people working for the best of the next generation is a major theme, so it suffices to say that teachers have a tendency to die protecting their students or their village. To wit: The Fourth Hokage, The Third Hokage, Asuma, Jiraiya. Even the ones that survive tends to almost die quite a lot.
Subverted with Kakashi for he was revived and Tsunade for she went into a coma and woke up from it.
In The Law of Ueki, when a god candidate helps their student champion in battle, they are automatically sent to Hell.
This happens in The Daughter of Twenty Faces, although this is more of a Missing Mentor case, as Chiko spends the rest of the series trying to find Twenty Faces.
Trickster Mentor Cross Marian in D. Gray-Man disappeared from the Black Order headquarters while he was under house arrest. Given the amount of blood and the fact that his gun and mask were found on the floor and there were signs of a struggle, he's currently presumed dead, but they Never Found the Body...
Most of Ala Rubra in Mahou Sensei Negima! is in some way incapacitated or made incapable of helping Ala Alba out, but this trope in particular hits Jack Rakanhard. Gets an Obi-Wan Moment trying to take out The Dragon and everything. Of course, like everything else about him, it's awesome.
Ends up averted by the fact he can WILL HIMSELF BACK INTO EXISTENCE, once, twice and apparantly permanently (although he needs an artifical body to walk around the real world).
In Beast King Golion, this was averted with Raible, who was a mentor to the Golion team.
Played straight with Hys, who was a mentor to the princess.
There's also L, who acted as a mentor to Mello and Near. The manga in particular suggests that Near's principal motivation in catching Kira is to avenge L's death - oh yeah, and justice too. That.
Martian Successor Nadesico has Gai Daigoji...who's entire role was to introduce anime to the crew and die pointlessly.
Comic Books
Agent 355 in Y: The Last Man is both recruited into the Culper Ring and trained by the previous Agent 355. One of the techniques she passes on is that the jaw is the most powerful muscle, so when the ex-mentor goes insane and tries to assassinate the President of the United States her successor bites her neck open.
Averted in X-Men by Professor Xavier, who died once but got better (it was never him). And like any mentor, he set a precedent that his students followed time and time again.
However because he's too smart and helpful, most plots especially adaptations will take him out of the story through coma or kidnapping or something until the problem is resolved. He's just not killed by them.
Subverted by Emma Frost, who outlives most of her students.
Stick, Daredevil's teacher, who dies protecting him, Elektra and his other pupils (The Chaste) from The Hand. Averted with Master Izo, who outlived all of his pupils. Although, Daredevil: Ninja seems to indicate that Stick got better...
Doctor Strange's mentor, the Ancient One, dies and becomes one with all reality. A subversion, since 1) he deliberately trained Strange as his successor, 2) he asked Strange to kill him, and 3) he's not "gone" in any strong sense.
Fan Fic
Persephone in Divine Blood is killed by her daughter Hecate's ghost while aiding her granddaughter, Eija, in a purification/crossing over. Eija is not amused.
Obi-Wan's own mentor Qui-Gon Jinn suffered a similar fate.
Obi-Wan was meant to live in the early versions of the Star Wars script, but George Lucas was frustrated in that during the big battle against the death star, he would have had nothing to do. It was Alec Guinness who took Lucas aside and set him straight.
Yoda dies too, although of old age.
Mick, Rocky's mentor, dies apparently from stress about Rocky's poor decision making skills.
Averted with Giles, who makes it through the series alive.
Oh, don't worry, the Season 8 comics took care of that little problem!
Subverted with Splinter in the Teenage Mutant Ninja Turtles movie, although we're led to believe he died at first.
Magi Lune in FernGully seems to exist entirely for this purpose. She appears in a handful of scenes only to later die at the end of the film to pass on her powers to Krysta.
Subverted in Reservoir Dogs: experienced criminal Mr White takes a bullet for his young protege, survives, then kills said protege after he confesses that he was the rat all along. And only then is he shot dead by the police.
Played straight in Kung Fu Panda with Master Oogway, though at least that's a natural old-age death, and then subverted with Master Shifu.
In Iron Eagle, mentor figure and Retired Badass Chappy Sinclair goes down early on in the assault on the enemy nation that captured The Hero's father, forcing Doug to fight the rest of the battle alone. Subverted in the end when it turns out Chappy bailed out and was rescued.
Averted in The Matrix: Morpheus survives all three movies. In fact, he's the only one of the three main characters to do so.
Jesus Christ from The Bible is possibly the ultimate example of this trope.
In a manner of speaking, John the Baptist also qualifies, as Jesus' "older" cousin and the guy who baptized him. He also qualifies in that he explicitly states he's not here to overshadow The Hero.
Mathin in Robin McKinley's The Blue Sword, one of the elite King's Riders, is assigned to tutor Harry Crewe in the ways of riding and combat. He lives, though, with an awesome scar from Harry's magical healing powers.
The penultimate example would have to be the despised Severus Snape. Before you rush to disagree, recall that he gave excellent advice while foiling Harry's attacks at the end of book 6.
Indeed, McGonagall and Arthur and Molly Weasley are Harry's only parental figures that don't fall victim to this trope, and even Arthur comes pretty close in book 5.
Dumbledore in particular clearly had to die, because he was the one person explicitly more powerful than Voldemort; the only person in all his life that Voldemort ever feared. If he weren't killed before Harry and Voldemort's final duel, the prophecy that Harry has to be the one to kill him would make no sense.
Since that main Potter mentor dude had managed to survive the first five books, it became a widespread assumption that the next one would have to kill him at the end so that Harry would spend at least one year without his mentor. It was so certain that the UK Guardian held a contest (spoiler link) for who could write the best death scene In The Style Of a writer of their choice.
Gandalf in J. R. R. Tolkien's The Lord of the Rings: In Book II of six the wise old wizard dies, leaving the rest of the Fellowship to go on in their respective ways alone. But he comes Back from the Dead again in The Two Towers and picks up where he left off, guiding everyone on their chosen paths.
Certainly applies to Beleg in Tolkien's The Children of Húrin as well, though he's more of a big brother figure.
That guy, what's-his-name, Obi-Wan Iroh Julio Scoundrel... Brom! That's it! Brom in Eragon.
Fraa Orolo had the misfortune of being revered by the hero and being smarter than the rest of the cast of Anathem combined. So, of course he gets exiled from the not-so-hidden elf village. After a good quarter of the book spent searching for him, they reunite briefly, then he gets promptly roasted by a volcano.
Tad Williams' Memory, Sorrow, and Thorn plays this deadly straight and justifies it. The Storm King and Utuk'ku deliberately set out to kill the members of the League of the Scroll and anyone else with sufficient knowledge to potentially unravel their Evil Plan before it was complete. Naturally, all of these characters act as Mentors to various protagonists.
Tad Williams' Otherland both uses and subverts the trope. Played straight: Renie's mentor Susan van Bleeck is beaten to death by the Grail Brotherhood's thugs; the old hacker Singh, who helps the heroes break through Otherland's security, is killed by the operating system. Subverted: Mysterious Informant Sellars continually attempts to aid the team after losing contact with them, but manages to stay alive until the climax, after which he surrenders his physical body for a virtual one.
Bluestar from Warrior Cats. Of course, like Dumbledore, she returned after her death to offer more guidance, and has continued to do so for the last three series.
Not to mention Lionheart, Yellowfang, to an extent Spottedleaf, Cinderpelt, and Whitestorm. Mentor figures in the series in general can probably be expected to die (then again, given the series in question...), but it still usually manages to be quite the Tear Jerker every time.
Brad Elliott in the Dale Brown books, who goes down crashing the EB-52 Megafortress into a Chinese ICBM site.
Kelsier in Mistborn, although his death is deliberate. Tindwyl's, in the sequel, is not.
In Codex Alera the spirit of Alera itself is suffering this. She was brought into existence by a mosaic taken from all corners of the country, which was broken. Without it she's dying, although in the last pages she implies that she'll survive in some form. Also, she doesn't actually die until maybe the very end of the book. Even then she might just have grown to weak to appear again.
Honor Harrington's mentor from her academy days, Admiral Courvosier, is killed in The Honor of the Queen.
And another mentor, Captain Bachfisch from her middie cruise, nearly gets killed in War of Honor, but manages to survive with just having his legs blown off.
In Robert E. Howard's "The Tower of the Elephant", Taurus, the Old Master thief, likes Conan the Barbarian's spirit when he finds him also trying to rob the tower and takes him along, with some instruction and help. Naturally, a trap kills him.
Averted or Subverted with D'ol Falla, who is The Atoner on top of being the mentor. It's The Messiah who ends up falling into the Bottomless Lake.
Syrio Forel, Arya's "dancing teacher" in A Song of Ice and Fire. In order to buy her time to run away, he stops to fight five guards and a knight with a training sword. He successfully kills or disables the guards, but has no chance against the fully armored knight.
Live Action TV
Notably averted on Stargate SG-1, where The Obi-Wan figure Master Bra'tac is noted for having survived through all 10 seasons of the show, despite multiple attacks by The Plot Reaper and even a feeling of depression in one early episode. He's just that badass.
I am not yet ready to give up. I feel alive Teal'c, like a young man... of eighty. We still have false gods to slay
Missing Mentor version in Buffy the Vampire Slayer. Wise librarian and all-round Badass Bookworm Giles takes himself out of the series to give his protege Buffy more freedom. He returns eventually and survives to the end, alive and well...though in the season 6 finale it was touch and go for a while.
Giles is the weekly series version of this trope — he can't very well die at the end of an episode so Buffy can fight the bad guy alone, then come back next week. So they did the next best thing: knock him out repeatedly.
They did kill him off at the end of Season 8 (the B.t.V.S. Comic continuation), however. Even then, though, it was more the emphasise that Anyone Can Die.
Zordon from Power Rangers: Kidnapped almost immediately after quitting the Mentor job, and his first act after rescue was to give one last mentor-y bit of advice and beg for an I Cannot Self-TerminateHeroic Sacrifice. A unique case of the mentor's death actually solving all the heros' problems.
Notably, he knew it was coming, and was trying to delay it.
Relic Hunter Sydney's old teacher who first gave her an interest in relics was murdered to obtain one. Twenty years later. Sydney caught up with the killer.
Zanki from Kamen Rider Hibiki; generally considered to be one of the better things about the show post-Re Tool.
Narumi Soukichi from Kamen Rider Double - doesn't really count as a spoiler since it occurs in the first episode.
Subverted in The Cape. Max is shot by Big Bad Chess, gives a tearful dying speech as he lies in Vince's arms... and then realizes it's Only a Flesh Wound.
Max: Dammit, I thought that was it! I wasted that great speech.
Manhwa
Interesting version in the Veritasmanhwa. The main character's mentor, Lightning Tiger, is killed right at the beginning of the story (and his pupil receives his skeletal arm in a box as a very creepy Tragic Keepsake). However, LT wasn't old, and he'd only been training the kid for about 2 months. A character attempts to justify it later by saying the he didn't die because he was a mentor; he took on an apprentice because he knew he was going to die.
Kingdom Hearts fans, say hello (and goodbye) to Master Eraqus.
Though he, just like every other character has been implied to come back, since as Nomura pointed out, nobody in the series (except Mufasa) has actually died in the literal sense of the word.
The player character's mentor Gorion dies in the first chapter in Baldur's Gate in a battle against the Big Bad. As he's also your foster father, this is also a case of Doomed Home Town.
In Metal Gear Solid, mentor figure Master Miller turns out to have been dead all along, having been killed a few days before the game begins, and impersonated from that point on by the Big Bad.
In Phoenix Wright: Ace Attorney, Mia Fey is killed right after the (very short) first case. She returns as a Spirit Advisor and The Obi-Wan for the rest of the Phoenix games and each game explains her unique state to the player.
Done in record time in Red Faction: Guerrilla - you arrive on Mars and meet up with your brother, who takes you on your first 'mission', recruits you into Red Faction and is shot by the EDF, all in the opening 10 minutes.
Done with the Professor in Cave Story, to the point that if you see him drop several stories and don't try to help him, he stays alive.
In Etrian Odyssey II: Heroes of Lagaard, players meet Flausgul and Kurogane early on and learn several important things about the Labyrinth from them. Once the player learns of their tragic history, alarm bells should be going off... the Player Punch comes upon finding an injured Kurogane and learning of Flausgul's fate. Kurogane hangs on just long enough for the player to take revenge.
Duncan in Dragon Age dies in the field of battle due to the signal made by the player character and Alistair for reinforcements not being answered by Loghain.
But it's also subverted for Mage Wardens, for whom Bad Ass Grandma Wynne fills the role. She's already technically dead, though.
Similarly to Duncan, Nihlus Kryik of Mass Effect 1 intended to accompany Shepard on a number of missions, most likely to train him/her as a Spectre, but he is killed at the end of the first mission by the primary antagonist actually Dragon, Saren.
Completely averted by Captain Anderson who is forced to stop being your mentor for other reasons and actually survives both the first and second game.
However, Anderson is the intro-level squadmate in Mass Effect 3. Things aren't looking well for ol' Dave's future, especially when one also considers the high mortality rate of intro-level companions in other Bioware games.
In The The Legend of Zelda: Ocarina of Time, the Great Deku Tree is cursed from the beginning of the game and dies after he sends Link off on his journey.
Also, Link's uncle dies at the beginning of A Link to the Past, after giving Link his sword.
In Ratchet & Clank: A Crack In Time, Azimuth was created specifically for the purpose of giving Ratchet a mentor figure. And, naturally, he died after going a little crazy and committing a Face Heel Turn, then realizing what he did and pulling a Heroic Sacrifice.
Web Comics
In The Order of the Stick, Julio Scoundrel hangs a lampshade on this trope in this comic though it hasn't happened (so far, anyway). So far his plan to never meet his student again is working.
In Homestuck, this has now happened to the Guardians of the Kids. Bro, Mom and Dad were all killed by Jack Noir, Grandpa was Dead To Begin With, and Bec has effectively ceased to exist due to his prototyping.
More like a mentor death contract, considering how sburb/sgrub works.
Happens to Lt.Col. Thomas Knowlton in The Dreamer.
Done via flashback in ReBoot. To flesh out Bob's backstory we see his cadet days interacting with full guardian Dixon, who gets killed by Killabyte. Since she was shown using Glitch in the flashback, this was easy to see coming.