Just know that resigning is always your right and you can leave a job if you have to. There are many reasons why people leave their jobs and you don’t have to feel guilty about it. Most of the time people feel guilty about it but you don’t have to. You should go ahead and do what you need to do.
Just imagine that if your employer need to lay you off, they would do it without any hesitation because they have to do it. They will give you a lay off letter. Therefore, you should do what you need to do.
Write the letter stating your reasons for leaving the company and that you wish them the best and give them plenty of time to replace a new employee. Sometimes you want to make your letter more polite rather than stating the true reasons because sometimes the reason why you leave is a bad one. Just be diplomatic and professional and nice.
Give them a 30 days notice so that they can find new employees. They would appreciate an advance notice rather then leaving them on a short notice. If you don’t have to be rude then don’t be rude at all.