Keep it short. There is no need to add lengthy explanations; if you need to get something off your chest, albeit in a professional manner, you can do so in a private conversation with your manager.
Adapt it to your contract. Showing that you have considered the terms of your contract shows that your decision is thought through and it avoids any nasty surprises.
Keep a professional tone. While you might be on friendly terms with your manager, remember that resignation is to be dealt with in an appropriate manner. Address your manager formally.
RESIGNATION TEMPLATE EXAMPLE:
Dear [Name of Recipient],
I am writing to notify you of my formal resignation from my role as [Job Title] at [Company Name].
As my contract requires that I give [amount of time specified] my last day will be [date].
Thank you for all of the opportunities for professional and personal development presented to me during my time here. I’ve enjoyed working for you, and appreciate the support provided me during my time at the company. If there is anything I can do to help with the transition, please do let me know.