A resignation letter is a letter formally advising your employer that you are leaving your job. It may help you to remain in good terms with your employer, just in case ...
Tips on writing a resignation letter:
It should be kept brief, simple, and as focused and positive as possible.
It should also include information about when you are leaving, but it should not include any kind of criticism towards your company or your job, if you want to mention why you are leaving.
It should offer some help too, if possible, with the transition; even if the offer is not accepted, it will be surely appreciated.
This is Steve Jobs' resignation letter to Apple's Board of Directors. You may find it useful as a template.