Keep it to yourself. Once you've made the decision, don't go blabbing it all over the company until you have notified your immediate supervisor. Give her or him time to absorb and process the information. If the company makes an attractive counter-offer, it will be awkward if you have already announced your plans to coworkers.
Plan to give notice. If you want to leave under the best possible terms, don't leave your employer high and dry, scrambling to cover your position. Give at least two weeks notice (or the minimum notice specified in your employment contract if applicable) so that your boss can prepare to have others cover for you, or have time to groom a replacement.
A moment of your time?Ask your boss for an appointment to discuss an important matter. Poking your head in and asking for a moment of his or her time will do - just be respectful of the fact that your supervisor has a job to do, and may not be able to drop everything at the precise moment you are prepared to spring this news on him or her. If there is too much going on, you will only add to your his or her hassles, so if it's at all possible, wait for a time when your boss will have a few moments to focus on your news. Be prepared, direct, and polite. Rehearsing privately will help you be ready when your supervisor has you in to talk. Most managers are extremely busy and they will appreciate your direct approach, forgoing the temptation to "cushion the blow," "find the right way to say this," or otherwise beat around the bush. You might say something like:
"I've been considering my options here for some time, and I've decided it's time for me to move on. I am grateful for the opportunities I've found here, but I must give my two weeks' notice."
OR... "I need to let you know that I have been offered a new position at another company. I have really enjoyed working here, but I need to give you my two weeks' notice as of today. Does it work for you if my last day is [whatever two weeks from then is]?"
Be prepared to discuss. Chances are you've been working with this boss for some time, and whatever your reasons are for leaving, she or he may have some questions. Or your boss may value you much more than you realized, and make a counteroffer. Being polite and dignified about your resignation could make this possible. You will need to consider in advance whether you would stay for a pay raise, increased benefits, a promotion, or other incentives. This would be a prime negotiating opportunity, so be prepared for it, and know your own bottom line. If staying is an option, what would make you open to it? Check the warnings below, though, because counter-offers can have some serious downsides.
Emphasize the positive. Be honest, but polite. If the boss asks you if he or she had anything to do with your decision, and was a factor, it's best to rely on tact and diplomacy to make an honest answer palatable. In other words, you won't help yourself by saying, "Yes, you're a lousy supervisor and I (or anyone) would have been way better," (even if it's true). You can be truthful without being cruel: "It was a factor, but not the entire reason. I felt our working styles and approaches just weren't a great fit, and that we never meshed as well as I wished we had. Still, the overall experience here has been positive; and with this opportunity, I feel excited to have new challenges."
Have a copy of your letter of resignation in hand. Make your letter brief, non-confrontational and professional. An example: "Dear Mr. Spacely: It has been my honor to work for Spacely Sprockets, Inc. This letter is to notify you that I will be leaving to accept a new position with another company as of [a date which is AT LEAST two weeks from the date of your conversation and letter]. Please accept my thanks for our association, and best regards to you and the entire company for the future. Sincerely, George Jetson."
Shake hands, smile, and thank your boss. Whether your departure is to relocate, to take a better job, or just to get away from this guy, show some class when you're walking out the door. Shake hands, thank your soon-to-be-former supervisor (yay!) for "everything," and leave. Go to your work station and stay there for at least 10 minutes. Now you can go blab it to everybody, but don't rub it in your boss's nose - be classy and simply confirm that you will be leaving.
[edit] TipsRemember that there are very few who are so free as those who have nothing to lose - but it won't serve you well in the future if you go shooting your mouth off just because you're on your way out. It won't kill you to make nice for two weeks, because you're getting out, and soon the entire experience will be behind you.
The jerk you leave behind today may well end up being your boss again - or perhaps even worse, your underling - in the future. And remember, too, that sometimes those jerks are oblivious to the fact that they're not well liked. If you are remembered as someone who was positive and generous in the past, you may well be greasing the wheels to a great future as this former boss of yours who is now your new boss puts you (the friendly face he remembers from before) ahead of the strangers in the new position. This may facilitate transfers to other branch offices, better assignments, and more.
Consider any counteroffer objectively and in depth. It may be wise to refuse any offers to stay with your current employer. Accepting a pay raise or other bonus after threatening to leave can cast you in a negative light with co-workers and the company as a whole. It can also make you seem indecisive and of questionable loyalty. Always keep a record of the offer in case you come back to the company in the future.
After informing your supervisor, be sure to personally tell other managers or key employees with whom you have worked that you have resigned. Say it in a way that "thanks" the person for helping you develop your career. "I don't know if you've heard, but I am resigning to take a position at another company. Before I leave I wanted to be sure to let you know how much I've enjoyed working with you." These people may leave for other jobs in the future and you want them to have positive memories of you. Who knows when they can impact your next career move.