No matter reason, if you want to leave your job, you have to write a resignation letter because it shows your kindness and good intention. When you have a positive reason to quit, you can mention about it in your letter such as going back to education. While you leave because of grievance, you never talk about it because this letter will be last conversation with your employer and it might cause a negative influence on your future job opportunity.
If you are not certain about how to start to write, you can follow basic rules I will mention about. Firstly, you should address the name of your employer and state that you are resigning. Then, you need to say the position you are resigning from and give a specific date for leaving. Thus, the company can find anyone instead of you in that time period. Also, important to give an appreciation of the time that you spent in the company. You need to thank them for all opportunities during your employment. Thus, you can seem courteous and positive. Besides that, you might give your contact detail to call you if they have to.
In general, you should be simple and brief during the whole letter. Also, you should not forget that you never use an emotional or controversial language. You never criticize them and avoid lengthy explanations about reason of your resigning such as more money.