Sometimes we authors decide to get a little too edgy for our own good. We want to shake things up, or surprise the reader, or whatever, and we kill off a beloved character. We think we're oh-so-clever. When fans see a beloved character die, their reactions are often not pleasant.
I read a book series once where the author killed off the coolest character in book three or four (can't remember which). After that, the series was bland and boring. The protagonist was a good guy, mostly, but he just wasn't cool. He wasn't badass. I learned a lesson then as an author: don't neuter your book of its most interesting character just for the sake of shock value, or to artificially raise the status of the main protagonist, or for any other reason.
Remember: you can always take a character off-stage for a while. There are many ways to do this. But death is sort of final. Don't kill off the cool guy.