To me, the worst way to have a character exit a show would be like Tara or Fred died. Sudden, random, senseless. Realistic for real life, I suppose, but still, not the final scene that I would have preferred for people who I had come to care about. Death, in fiction, at least, should have a reason, not just a random bullet or puff of mystic vapor.
The best way to handle a character's death would be like Buffy, either time, Spike in Season 7, or Wes. A noble sacrifice, willingly, if not happily, made so that others might live. Laughter in the face of death, the way that Spike did it, is just icing on the cake.