This is for when the benefit of what you do to someone isn't so much in and of itself as about the message it sends to others, about what could happen to them. As is implied from this, what happened needs to be known in order for it to work. While the most common "example" is death, Genre Savvy punishment forces realize this can backfire, and will go for the Fate Worse than Death.
It is often associated with governments, especially the more tyrannical of them but not exclusively; see also the deterrence argument for use of this in the context of more democratic societies. Also, even forces outside the law, like terrorists, criminal syndicates, and Serial Killers, apply this as well. It's also very common with revolutionary forces; with prisoners, stringing up or dumping their mutilated remains serves as a warning to soldiers of the current regime, while population centers that they suspect of being in league with the regime or even just not being supportive of them are likely to be brutalized as a "stand with us or else" message.
Note that the "example" is usually more severe than the "normal" punishment, making this Disproportionate Retribution.
Tokyo ESP has the female main protagonist subjected to a complete No-Holds-Barred Beatdown until she's literally killed to show what happens to those who try to be heroes. They were able to restart her heart, but the damage was extensive.
Films — Animated
This tactic is often featured in Disney movies, and often associated with (or at least more explicitly mentioned by) the villains:
The above page quote, of course, refers to the Disney version of The Hunchback of Notre Dame. The context of the quotation (trying to justify burning down a house with a family trapped inside. Scene viewable here.) is not the only example; Frollo whipping the previous captain of the guard in front of the next one, apparently to show what happens to captains who disappoint Frollo, is likely also an example of this.
In The Lion King, Scar's Villain Song is punctuated at one point by him backing one of his hyenas into an open fissure in order to assert his dominance over them in his master plan ( which makes his later death at their hands as a result of his exploitation of them all the more ironic).
Scar: The future is littered with prizes,
And though I'm the main addressee,
The point that I must emphasize is:
YOU WON'T GET A SNIFF WITHOUT ME!
Pixar villains also tend to use this tactic, and a theme that often comes up with them is that they are trying to deter their victims from thinking.
Hopper, from A Bug's Life, uses this tactic often. He gives a speech to the other grasshoppers about how if "you let one ant stand up to us, then they all might stand up," and to drive the point home, even uses a demonstrated analogy involving grains that results in several of his henchmen getting buried; it's twofold in involving him applying it to his own henchmen in the context of a speech made to get them to apply it to the ants. Later on, it's revealed that he plans to squish the queen so as to "remind [the ants] who's boss," and also tries to find out whose idea the bird was so as to make an example of him or her.
Hopper: Let this be a lesson to all you ants: Ideas can be very dangerous things.
Lotso, from Toy Story 3, has the few who tried to escape Sunnyside cornered near a dumpster so that if they do not agree to go back to Sunnyside, Stretch could throw them in, in front of Chatter Telephone and Twitch.
Lotso: This is what happens when you dummies try to think!
Films — Live-Action
Paths of Glory. During World War I, an entire division of French soldiers refuse to go on a suicidal mission. Three soldiers are chosen at random to be tried & executed for cowardice.
While the incidents themselves were fictionalized to the point of being almost unrecognizable, the events in the movie (and the novel it was adapted from) were based on real incidents.
Pirates of the Caribbean provides the page image. Though it's notably ineffective, as not only does piracy run rampant through the Caribbean, Jack Sparrow removes his hat and salutes the hanging bodies of the pirates, presumably in honor of their "noble sacrifice."
The original Total Recall (1990) seems to feature this on Cohaagen's part, although being Cohaagen, it is likely there is some spite added in there as well.
Technician: Sir, the oxygen level is bottoming out in Sector G. What do you want me to do about it?
Vilos Cohaagen: [as if obvious] Don't do anything.
Technician: But they won't last an hour, sir.
Vilos Cohaagen:Fuck 'em. It'll be a good lesson to the others.
In The Shawshank Redemption, Byron Hadley beats an emotionally-overwhelmed inmate to death on the prison floor for complaining out loud that he shouldn't be in prison. It is strongly implied that he is doing this to scare the other inmates into keeping their mouths shut.
In A New Hope, Tarkin makes an example of the entire planet of Alderaan, after first rejecting Dantooine (where he was told the Rebel base was) for being "too remote to make an effective demonstration."
Expanded Universe material state that Tarkin's plan backfired and the rebellion used Alderaan to recuit thousands.
YognappedBig Bad Sben threatens to string up the spinal cords of some scientists who might delay his operation, as a "motivational tool" to the others. He doesn't follow through with this, but he does end up killing one via eye stabbing.
Rosario Vampire: Brightest Darkness Act II: When Fairy Tale is occupying the Snow Women Village, Miyabi decides to have Mizore's mother Tsurara executed to teach the other snow people their "place." It also doubles as a big Kick the Dog moment because mere moments before giving the order, he'd extorted Mizore for sex in exchange for not doing so. Fortunately, Tsukune and the others put a stop to it.
In Voltaire's Candide, the title character witnesses the execution of an admiral which is explained to him with the famous line: "In this country they find it necessary to kill an admiral from time to time, to encourage the others (pour encourager les autres)." The scene is based on the Real Life execution of the British Admiral Byng, whom Voltaire had met, for alleged cowardice in battle.
In the Deryni novel Camber of Culdi a tyrannical Deryni lord is murdered and dismembered, with his body parts left in various places. Fifty peasants are taken hostage and all but one executed when the killer(s) fail to turn themselves in.
In Wyrd Sisters, the Duchess has a thing about having underlings punished as an example to the others. The Duke remarks that if she keeps it up, eventually she'll be having the last remaining guard cut his own throat as an example to himself.
Visser Three uses this tactic, or *thinks* he is, on the runaway Hork-Bajir in Animorphs "The Change". Only, the real Hork-Bajir are somewhere else, and the two 'dead' ones and the wolves 'eating' them are morphed Animorphs. He intends to do this with Aftran in "The Sickness", but Cassie rescues her before it can happen.
In The Wire, the Barksdale Organization that controls the West Side of Baltimore starts out as the most dominant and ruthless drug syndicate in the city. When Omar and his two stick-up partners steal from a Barksdale stash, Avon Barksdale quickly declares he wants an example made. Within days one of the partners is found dead (his Bullet Proof Vest not having done much good against the 46 shell casing found around his body) while the other is brutally tortured to death, then left on display in the projects as an example.
Gob: I had to fire them. I had to make them an example to the others. Michael: There are no others. You fired everyone.
On one episode of Friends, Monica starts working at a restaurant as the head chef, but can't seem to gain respect from her staff. (They were very friendly with the guy she replaced.) Joey suggests that she bring him in and fire him just to prove she means business. She does, but given that this is Joey we're talking about, it doesn't go as planned.
A perfect example of this happens in a 2009/2010 storyline of General Hospital; Michael attacks Claudia Zacchara to protect his mother Carly and newborn sister, but accidentally kills her. As a result, Carly, Jason, and Sonny all opt to ship Michael out of Port Charles and for Sonny to take the fall, but just as the jury is about to announce their verdict at Sonny's trial, Dante Falconeri, Sonny's recently discovered firstborn and a PCPD detective, discovers the truth and gives Michael up, expecting that the judge will let Michael off with a suspended sentence. Instead, the judge, furious that Michael's family had been lying for months and fed up with the constant Courtroom Antics, decides to make an example of Michael for all those who try to twist the law for their own ends by sentencing Michael to two-to-five years in the Pentonville Adult Correctional Facility.
An unplanned version at the end of the Firefly episode "The Train Job". Mal tells Crow that he's giving him back all the money Adelai Niska advanced them for the job and that they'll stay out of his way from now on. Crow tells Mal that the last thing he'll see is Crow's blade. Mal kicks him into Serenity's engine intake and brings over the next guy, who falls over himself to agree before Mal can finish offering the deal.
In Twilight Princess from the same series, Zant executes the Zora queen when he shrouds the Lanayru Province in twilight. This later sets up a subplot when her son, Ralis, falls ill on his way to Castle Town to get help.
Early in Dragon Age II, you're given the choice between helping a group of mages flee the Kirkwall Circle or turning them in. If you pick the latter, Knight-Commander Meredith has three of them hanged as a lesson to others (picked at random, at that). It's a good indicator of how she operates.
In The Order of the Stick, the Thieves' Guild has a tendency to be very harsh with people who break their rules. Guild members who try to leave are usually killed, while guild members who sell secrets receive harsh punishments, like, say, having any body part they're nicknamed after removed.
Old Blind Pete (formerly "Eagle-Eyed"): A word of advice: If you're going to do business with criminals, don't pick a nickname based on any body part you can't afford to lose. *sigh* I shoulda listened to Appendix Steve when he tried to warn me.
A common police tactic to break up protests is by arresting a few people. This video of the Occupy Wall Street protests is a good example.
This was explicitly involved in the suicide of hacker Aaron Swartz, the department of justice arguing for a disproportionate sentence to, in their own words, "send a message".
Maggie Thatcher did this to Thames towards the end of The Troubles. The 1990 Broadcasting Act which instigated the franchise round that destroyed the original Thames? That was Thatcher's not-so-subtle way of punishing Thames for broadcasting "Death on the Rock".
This is actually the main gist of two Chinese proverbs- "Kill one to warn a hundred", and "Kill the Chicken to Scare the Monkeys".