You've decided to leave your job. Whatever the cause of your departure, it's never going to be easy. The first thing you should do is have a conversation with your boss. That talk is your opportunity to provide your reason for leaving (because even if you don't want to share it, chances are high that they're going to ask, so be prepared).
Whether required by your company or not, you need to write a formal resignation letter. This not only sets the tone for your remaining time at the company, but also for your future relationship with your employer. No matter what, keep it simple. Here's how to pull together a savvy letter of resignation.