I'm not against bad endings. I'm not against tragedy in media, or literature that looks long and hard at things most of us flinch away from. I'm not against bittersweet endings; nothing makes triumph more poignant than sacrifice. I'm not against even the most hopeless of hopeless downer endings--if they're written well.
Some of the people who perpetrate that sort of ending do not write them well. They're amateur authors trying their hand at injecting the most EZ-bake anguish they can find into their story--that being death, cancer, or a freak accident between two trucks carrying payloads of newborn kittens. Here's a message for you folks: don't do this. There's nothing more painfully pointless than invalidating the main character's 300-page long struggles by having him trip over a plot doorstep and decapitate himself. If the protagonist is going to die, have them do so in a way that matters--and no, I don't mean slapping some ham-fisted, meaningless symbolism on there and calling it a day. This isn't a guide to 90's comics. What I mean is this: have them accomplish something. Whether that be stopping the bad guy's plan, having an emotional scene, coming to peace with their sins, or whatever--have the death mean something. Or else it's just going to come off as cheap, two-for-99-cents drama, because that's exactly what it is.
"Extra, extra! Kirby has polio, read all about it!"
For instance, say you're writing a story set in the present day. A stream-of-consciousness autobiography narrated by your main character, who is at a high point in his life; he got the girl, the job, and has a kid on the way. But, after a routine trip to the doctor, he learns that he has [INSERT FATAL ILLNESS HERE] and will only live for another year or two. From here, you could just write about how tragic and sad and Oscar-baity this all is. That would be bad. No, I'm not saying the plot point itself is bad, but here are better ways to do it:
1: He realizes how much everything in his life matters to him, and vows to make the people who supported him happy. He splurges on gifts, trips, all he can afford without draining the family account. He makes up with old enemies, and meets up with old friends. He does the things he always told himself he would do, but never did. He can, and does, die fulfilled.
2. He feels betrayed. How could random chance, genetics, or whatever else is responsible take his life away from him? He gets a drinking problem, starts arguing with his wife, loses his job. All he can think about is the deadline, the time he has left. Tick tick tick, drink drink drink; it keeps slipping by. He's hounded by regrets; debts unpaid, people unmet, ends not tied, and things both done and not done. Perhaps he makes peace with it by the end; perhaps he finds meaning in the old family religion, or in a book, or a cloud, or a past acquaintance. Perhaps he never does, and dies angry at the world that gave him it all only to yank it away without cause.
Those are by no means the only ways to proceed, or the most original; they're just examples of how to use tragic events to flesh out and enrich your plot, as opposed to just throwing them in like ghost peppers in a pasta sauce. Carelessly adding such potent ingredients to a recipe is a bad idea, and it's the same thing with a story; fuck up bad enough and both scenarios end with someone taking an apocalyptic volcano shit, be it in your bathroom or your comments section. Handle with care; do whatever you can to ensure that the tragedy isn't meaningless. After all, meaningless is the worst thing that a tragedy can be.
Tragedy is not inherently a bad narrative tool; neither is death, or heartbreak, or a case of spontaneous combustion at a wedding. The thing is, they need finesse to be properly handled--a hell of a lot more finesse than it takes to write most other things. They need purpose. A bad ending isn't good writing just because it's sad--and it's quite awful writing if it makes your reader go "Wait, what?" instead of reaching for a box of "I'm not crying, there are onions committing seppuku on my counter" brand tissues.
Or "Decapitated Shakespeare's Thousand-Yard Stare" (tm) by Downy.
So please, authors and authorettes, before you pen the dark, existential final chapter of your Dora the Explorer fanfiction, take pause and make sure you aren't tossing in Swiper's tragic death to lung cancer just for kicks. Make the slow, agonizing slip of a cartoon fox into the talking object-filled afterlife matter, dammit.