The many deaths of Optimus Prime

Across all continuities, Optimus Prime dies a lot. This happens for various reasons:
 * It allows for him to be replaced by a new character (and thus a new toy).
 * It allows for him to come back from the dead in a new body (again, a new toy).
 * It's dramatic.
 * It makes him into something of a Christ-figure.

Some examples:

The Transformers: The Movie

 * The best-known example is from The Transformers: The Movie (1986), in which Optimus Prime dies of wounds from his battle with Megatron. Famously, his body turns gray as he dies.  (Urban legend says his body also crumbles, but no such footage is known to exist.)
 * He returns from the dead twice in the following season of the cartoon, first as a zombie in "Dark Awakening" and then (for reals, yo) in "The Return of Optimus Prime".

Generation 1 Marvel Comics
In the Marvel US continuity, dying and coming back was practically a hobby for Prime.
 * In "Afterdeath!", Prime, after failing to live up to his moral principles while playing a video game, volunteers to be killed. The Autobots launch his funeral bier into space.
 * Fortunately, the creator of the video game, Ethan Zachary, saves a backup copy of Prime's mind on a floppy. We first meet this virtual Prime sixteen issues later in "Pretender to the Throne!".  He gets his new Powermaster body two issues thereafter, in "People Power!".
 * About thirty issues later, Prime sacrifices himself to defeat Unicron, in "On the Edge of Extinction!".
 * However, his Powermaster partner, Hi-Q, survives, and almost immediately begins babbling about how he's really Optimus Prime. This turns out to be true, and The Last Autobot metamorphoses Hi-Q into Prime (with a new Actionmaster body) in the last issue of the original Marvel US series.

Generation 2 Marvel Comics

 * This Prime wasn't done dying yet. His adventures continued in the G2 comics, and he died defeating the Swarm in the final issue of that series, "A Rage in Heaven!".
 * But the Swarm reconstituted him three pages later (in a body based on his then-current Combat Hero toy).

The Beast Era
In Beast Wars and Beast Machines, you could mark the end of a season by the near-death experience of one Optimus or another. . . (Strangely, the end of the third season of Beast Wars had no Optimus deaths whatsoever! A half-dozen other characters died, but not Op.  Bizzah.)
 * At the end of the first season of Beast Wars, Optimus Primal piloted a bomb-equipped stasis pod in an attempt to destroy the Planet Buster. Unfortunately, Megatron had sealed the pod's hatch, and Optimus blew up with it.
 * Early in second season (a few hours later as far as the characters were concerned), Rhinox managed to unite Optimus's drifting spark with a blank protoform, thus bringing him back to life (and in a new transmetal body, too).
 * At the end of second season, the Beast Wars Megatron comes very close to killing the original Optimus Prime. But, Prime doesn't quite die, so we really shouldn't count it.
 * At the end of the first season of Beast Machines, Optimus and Megatron had a cataclysmic battle, using the energies of Vector Sigma and the Plasma Energy Chamber. This would have destroyed Cybertron, but Optimus took the warring energies into himself, and disintegrated.
 * However, his spark was trapped within the Oracle, and the other Maximals convinced him to return to the real world, at the start of second season. The Oracle kindly gave him a new body.  (Which, believe it or not, was not a new toy.)
 * And, at the end of the series, Optimus gave his life to defeat Megatron once and for all, pushing him into the technorganic core of the planet.
 * In assorted ancillary media (convention comics, text stories), he comes back to life, yet again.

The Unicron Trilogy

 * In the Armada episode "Crisis", Optimus Prime used his body to block the blast of Megatron's Hydra Cannon, protecting the Earth. When the cannon's energy is spent, we see Optimus turn grayish-white, then actually crumble to bits.
 * A bunch of Mini-Cons use the Matrix to resurrect him three episodes later.

Worlds Collide

 * The corpse of an Optimus Prime from an alternate universe (killed by Unicron) appeared in the Armada comic issue titled "Worlds Collide, Part 1". Yep, practically all we know about this Optimus is that he died.

Transformers Animated

 * In part three of the pilot movie "Transform and Roll Out!", this universe's Optimus Prime dies after his battle with Starscream. Like the G1 Prime before him, he turns gray upon dying.  Seventy-five seconds later, Sari Sumdac uses her mysteeerious All Spark key to revive him.