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, 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.)

Generation 1 Season 3

 * He returns from the dead twice, first as a zombie in "Dark Awakening"—which ends with him dying again—and then (for reals, yo) in "The Return of Optimus Prime".

The Headmasters

 * In The Headmasters, Optimus Prime was killed again when he tried to bring Vector Sigma back under control in "A Dream Is Born, Double Prime". His body turned gray as he died. He was later resurrected and evolved into Star Convoy by the power of Zodiac in Battlestars: The Return of Convoy.

Generation 1 Marvel Comics
In the Marvel 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!". The Swarm reconstituted him three pages later (in a body based on his then-current Combat Hero toy).

Japanese Generation 2

 * in the Japanese version of Generation 2, Optimus Prime was badly wounded by Megatron's fusion cannon and almost died, but was resurrected and evolved yet again, this time into Laser Rod Optimus Prime, by the power of the Matrix.

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 Optimus.  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 the 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 came very close to killing the original Optimus Prime. But Prime didn'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).
 * 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.

Armada cartoon

 * 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.

Armada comic

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

Universe

 * The corpse of an Optimus Prime (killed by Megazarak) from an alternate universe was cloned by Unicron to create Nemesis Prime. The clone, before he became Nemesis, appeared in Universe comic issue "Balancing Act, Part 2". Once again, practically all we know about this Optimus is that he died.

Animated

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