I'm a combination of a pantser and a outliner. I outline to a degree, let my imagination fill in the rest, and deviate from my plan if my characters feel so inclined. However, the one thing that I have never gone off-track with in my writing is when I kill off characters. When I sit down to write chapter one, I know exactly who will die, when, and why.
My philosophy on character death is very simple. I love it when a great character gets a wonderful death scene, because it can really give that character one final hurrah before they leave the story. However, if a character death feels contrived or put in simply for dramatic effect, I get really angry.
Whenever you decide to kill off a character, at whatever stage you are in your story, you have to ask yourself a few important questions.
1) Why am I killing this character off? You need to know this answer. This should be the FIRST question you ask yourself when character death pops into your head. WHY are you doing this? Will their death progress the plot? Give your MC more motivation? Give them heartache? You can have a dozen reasons for this, so long as you have one. Using character death to eliminate someone whose become unnecessary to the story is NEVER okay. Find some way to work them out of your story, or back in, or get rid of that character all together.
2) What effect will this have on the story? This is a little different than why. Think of a ripple effect. Everything a character does in a story has consequences, and so should this. If this character is important to the MCs, or villians, or just a primary player, their death will change the dynamic of the story. This is also how the reader will get hit with that solid emotional punch. It's not just that the character's gone, but in their absence, everything has changed, either for the better or worse.
For example, in Shell, one of my main characters is killed off, and the dynamic of the group of friends vastly changes. They went from being very close friends to each drifting away and falling apart on their own. It was more than just killing someone off. It was how that affected those left behind.
3) What do I want the readers to feel? This is my favorite question, and the one I have the most fun with. When this character dies in the story, how do you want your reader to feel about it? If this is a traitor's death, you may want your reader to be happy that this evil person is gone. How do you do that? Set up the character as sympathetic, and then take away all the sympathy during the betrayal. When we get to the death scene, watch your dialogue, watch every detail. Think of how your character is feeling as they die. What are their regrets? Their wishes? Their last thoughts? Now combine that with what you want your readers to feel. If you want them to feel remorse for your traitor, highlight sympathetic traits as he's dying, or shortly beforehand. Maybe show regret, so that even when they're gone, your reader feels some pity for them. Or, you can elimate all symathy during the death scene, and have him go down snarling and screaming, which will leave a very different last impression for your reader.
This is a question you must ask yourself as you write all the way through. Every time this character comes into play, consider that they are going to die. Their screen time is limited, so you have to make the best of it. Amp up the sympathy, but don't make them into a whiny baby. Craft them into a hero, so their death has that extra punch.
If you need to think of a good example of this, Rue from the Hunger Games is a perfect example. Her character is extremely sympathic, and coupled with her gruesome death, it leaves a heartbreaking last impression on your reader that resonates with them.
Always remenber: Someday, somebody reading your book will fall in love with this character, and when they die, you need to make sure their death is justified, so that reader will put down the book and admit the story is so much better for it.