• First, be sure resigning is the right decision. Don't do it in a huff, to make a point, or in the hopes that it will make them realize how much they need you.
• Do it in person. Unless you have virtually no personal relationship with your boss, this is not a message to send by E-mail or via a letter left in your manager's inbox. Request a meeting, and say it face to face.
• Be prepared for your boss to ask you why. I'm a proponent of being honest unless you're worried that honesty would burn bridges. If your boss's management style or the company's culture or the long hours were part of your decision, you're doing your boss a favor by saying so, as long as you're tactful about it. (For instance, tact might mean saying that it was a factor, but not the whole reason.) On the other hand, if your boss is a tyrant, can't take criticism, or is otherwise unlikely to respond favorably to candor, go with something safe and bland: You want to "take advantage of an excellent opportunity," "get experience in new areas," or have a shorter commute. In this case, it's not your fault her employees can't be honest with her.
• If your boss does react poorly to the news, this reflects badly on her, not on you. Stay professional, and simply reiterate that you've enjoyed your time there but will be moving on. Emphasize what you're planning to do to make a smooth transition. (And, for the record: The correct way for a boss to respond is to congratulate you and tell you how sorry she will be to lose you, and to ask what could have been done differently to make you want to stay.)
• You must give at least two weeks notice. Period. Unless you want to burn bridges and tarnish your name in a way that may follow you around forever, you must give at least two weeks and, in some jobs, more than that.
• If you can give more than two weeks, consider doing it. Pay attention to how your employer has handled other employees who resign. Are people shown the door immediately? Pushed out earlier than they would have otherwise planned to leave? If so, assume the same may happen to you, and give two weeks and nothing more. But if your employer has a track record of accommodating long notice periods, has been grateful to employees who provide long notice, and has generally shown that employees can feel safe being candid about their plans to leave, take your cues from that. (It's in most employers' best interest to do the latter, but too few of them do, and they end up with employees who have no choice but to limit their notice periods to two weeks. This is counterproductive because it ends up denying employers a head start on the hiring process, which they otherwise could have had.)
• Offer to do whatever you can to make the transition go smoothly—and then do it. For instance, leave thorough documentation of how you do your job, contacts, passwords, etc. Make sure all your E-mail has been answered, your replacement well trained (if time allows), and remaining work well organized. Offering to be available for a phone call or two with your replacement after you leave is optional but can generate substantial goodwill.
• Don't check out during your remaining time.It will show, and it can damage the reputation you might have spent years building up. Stay engaged, don't start coming in late and leaving early, and care as much about leaving your work in good shape as you cared about your performance up until now.
Like a breakup, the way someone leaves a job can tell you a lot about who you've been involved with. Handle yourself well, because you may cross paths in the future.
Alison Green is chief of staff for a medium-sized nonprofit where she oversees day-to-day management of the staff as well as hiring, firing, and staff development. She is working with the Management Center to coauthor a book on nonprofit management. Her writings have been published in the Washington Post, the New York Times, Maxim, and dozens of other newspapers. She blogs at Ask a Manager.