In Puella Magi Madoka Magica, Kyubey has this mindset, which is pretty much a requirement when it's your job to harvest the despair of those that become Witches in order to save the rest of the universe from entropy. In fact it can't think any other way: it has no emotions, and therefore sees everything through logic and reason. Sacrificing one life for the good of many others is a logical (if not always moral) thing to do, so naturally it views this as acceptable. Kyubey cannot even comprehend why humans value one life when there's six billion of them and growing.
Naruto: The Fourth Hokage discusses this with Kushina about sealing the Nine-Tailed Demon Fox into their son Naruto, damning him to a childhood of loneliness and misery, in order to protect the village and country.
In Bokurano, the pilots of Zearth, once chosen, have 48 hours to complete their battle- the loser's universe is destroyed, and the chosen pilots die even if they win, from having their life force drained to power Zearth. Naturally, some of them do not take this well, especially not Chizu, who, learning that she is going to die, plans to kill the men who gang-raped her, having planned on a murder-suicide until she discovered she was pregnant.
Chizu: Then tell me, Why do I have to die? Why do I have to die? Why does this baby have to die? Circumstance? Coincidence? Inevitability? Fate? For the past month, those are all I've thought about. And I've decided... that the death of any person is meaningless.
Green Lantern Hal Jordan fought in the Corps' first war against Nekron when he entered the Death God's nether world to distract him enough to allow the Corps to drive back Krona's army while the Guardians to seal the inter-dimensional rift. At all this, Jordan's energy field is decaying rapidly as he sees himself being trapped in that other dimension and will die instantly once it fails. The one comfort Jordan thinks that it's his life for the trillions upon trillions of lives he helped save, a really flattering trade when you think about it. Fortunately, at that moment, the spirit of Jordan's predecessor, Abin Sur, helps his successor escape the rift.
In an old Spider-Man comic he ends up fighting over an antidote against the Inhumans. Spider-Man needs it to save the life of a man who saved him and MJ from being hit by a truck, the Inhumans need it to prevent a doomsday device from destroying the world. After they fight Spidey finally explains why needs it and Black Bolt flies to the hospital with the rest of the antidote. In the end Gorgon tells Spider-Man that saving the entire world was important enough to risk the death of the man, since what is one life compared to all others. Spider-Man's reply is along the lines "If you have to ask, you will never know the answer."
In the Transformers: Revenge of the Fallen, Megatron asks this of Optimus Prime when they are fighting over the knowledge implanted in Sam Witwicky's brain by a shard of the Allspark. Optimus knows better, though.
Megatron: Is the fate of our planet not even worth a single human life? Optimus: You'll never stop at one.
In Stranger Than Fiction, the protagonist is told that he should allow the writer to kill him off, as the contribution to the world's literature as a whole is more important than his own life. It's implied that he ultimately decides to sacrifice himself, not to for literature's sake, but to save a little boy. This ends up prompting the writer to rethink her whole approach.
Main plot point of the movie The Pink Panther Strikes Again. Dryfus creates a doomsday device and blackmails the world with it. All he wants is for someone to kill Clouseau.
In the film Sunshine, a character comes close to mentioning this trope by name.
Invoked twice in Flash Gordon: first by Zarkoff and then by Flash himself, when faced with the prospect of having to sacrifice themselves to save the Earth. "It's not madness, it's a rational transaction: one life in exchange for millions."
From The Bible - "Neither do you consider that it is expedient for you that one man should die for the people, and that the whole nation perish not." — John 11:50 (Douay-Reims).
The irony in this verse is Lampshaded in the next verse, which says that the High Priest was speaking in his role as a prophet at the time, even though he didn't realize the implications of what he was saying.
Likewise The Book of Mormon - "Behold the Lord slayeth the wicked to bring forth his righteous purposes. It is better that one man should perish than that a nation should dwindle and perish in unbelief." — 1 Nephi 4:12.
In A Song of Ice and Fire, this is Melisandre's justification for wanting to sacrifice Edric Storm. She says that the sacrifice is necessary, and if they don't do it, Edric will die anyway along with everyone else when the Long Night comes.
However, there was no guarantee that the sacrifice would work, and all indications seemed to point towards it never working. Melisandre is such a fanatic however, that she often refuses to see the flaws or failures of her plans.
In Harry Potter, the titular character discovers that he has to die in order for Voldemort to be defeated. He takes this attitude towards his own death. Of course, he ends up living anyway.
In Enchantress from the Stars, if a Federation agent is captured, and it stands to reason that he or she will cannot prevent divulging the information about The Federation, the agent is supposed to commit suicide. Of course Elana, the main protagonist is only told this after she is captured during the action which she probably wouldn't undertake had she known this beforehand.
And since her father doesn't quite trusts her to commit suicide he secretly sends her fiance to either free or kill her, only stopping the plan at the last second. Double facepalm since earlier he explicitly declined giving her the order to die
Of course, Elana, after encountering the way The Empire treats its captives, actually finds the idea attractive.
That's why you came to me, isn't it, Captain? Because you knew I could do those things that you weren't capable of doing? Well, it worked. And you'll get what you want: a war between the Romulans and the Dominion. And if your conscience is bothering you, you should soothe it with the knowledge that you may have just saved the entire Alpha Quadrant. And all it cost was the life of one Romulan senator, one criminal, and the self-respect of one Starfleet officer. I don't know about you, but I'd call that a bargain.
In Doctor Who, the Doctor leaves a lot of people as necessary victims of history, time or (in)convenience, sometimes directly against their will. He gets the other part of the rope in The End Of Time, where he revolts against destiny as being more important and having the power to do much more before entering into the ready-to-kill chamber.
And occasionally, and memorably, he'll absolutely refuse to make the sacrifice: one example is Pete Tyler, Rose's father, whose rescue from his would-be death upsets the timestream to the point that the entire planet is apparently on the brink of destruction, and the Doctor refuses to kill Pete again—even at the cost of his own life.
In Babylon 5 this is invoked to G'Kar by Ambassador Kosh (appearing as G'Kar's father, "Some must be sacrificed so that all may be saved." The encounter changes G'Kar from a revenge-driven Narn patriot into a self-sacrifical warrior. However, G'Kar later realizes this isn't a statement about the future but explanation of not revealing the Shadows were helping the Centauri. This is because while there are millions of Narns dead now after the war, had the Shadows been outed during or before the side of Good was ready, billions of Narns would be dead.
In Sound Horizon's Moira, fed up with the way Moira torments and manipulates people in life, Thanatos concocts a plan to confront and overthrow her - A plan which involves tormenting and manipulating a man all through his life. The final two tracks of the album imply that not only did this plan fail, but that Thanatos has since been futilely attempting this plan over and over again for gods knows how long.
In SaGa Frontier, after defeating his twin in a Wizard Duel, Blue finds out that he was Split at Birth and manipulated into killing his other self so he'd become the ultimate magician and waltz into Hell in order to protect the Magic Kingdom from the demons within. Upon finding out, he initially refuses because the idea of the kingdom's existence being "much more important than any magician's life" is the most selfish thing he'd ever heard.
At the end of Blood Omen: Legacy of Kain, Kain is given the choice between sacrificing his own life to restore balance to the world, or using the power he has accumulated to "rule the world in its ruination" - and furthermore, he had been deliberately manipulated towards this end, by someone who expected him to make the 'selfless' choice. He refuses, and so the sequel Soul Reaver kicks off in the Crapsack World that results. As the Mind Screw threads of the Timey-Wimey Ball are slowly unravelled, and the true identity of The Man Behind the Man is revealed, however, it turns out that Kain's decision was the better option for the world. If he DID sacrifice himself, it would only condemn the world to dance at the strings of an unknowable Eldritch Abomination. After Kain learns this, he chose to appear as a villain, while carefully engineering the timestream, pushing it to the point where he could "make the coin land on the edge", creating a Third Option for the dilemma.
In Marilith, one corrupt cop says this about letting Valentinonote who's busy killing other gangs roam free:
"What's the lives of two girls against dismantling most crime in the area?"
In Futurama, Fry was originally frozen so he'd survive long enough to save the universe in the year 3000, but because the Nibblonians were afraid he'd say "no", they never gave him a choice in the matter.
In the Batman: The Brave and the Bold episode "The Last Patrol!" The Doom Patrol are forced to let a single hostage die at the hands of General Zahl to save the millions of people in Paris. The trauma of this caused the Patrol to split up. They are brought back again, this time with the General threatening to destroy an island fishing village if the Patrol don't take the places of its people. This time, they DO make the sacrifice—and Zahl kills them. However, since their deaths are broadcast over the world's airwaves, this final sacrifice causes them to be admired all the world over. Zahl is forced to admit to himself that because of this, even in Death, the Doom Patrol had beaten him once again. The island's people rename it "Four Heroes."
In Justice League, J'onn Jonzz, the Martian Manhunter really seemed to have taken to using this trope. When Doctor Fate attempted to reason with AMAZO, who had been walking all over the entire League, J'onn pulled this trope. And Fate's response?
"Those words are always used to justify destruction."
The next time was when Mister Miracle's friend Oberon was kidnapped by Granny Goodness and Miracle asked help from the League. J'onn refused because it would only help to put order into Apokolips, thus risking them turning their attention to Earth. Apparently he thought Flash wasn't looking at the big picture when he wanted to help. Flash thought the league was all about helping.
These incidents are part of Jonzz's negative character development as he becomes more and more detached from people as a result of isolating himself on the Justice League satellite. In the end, he goes on leave to find himself.