Regardless of why you have decided to leave your current position, you need to approach this situation very carefully. You do not want to burn your bridges with an employer - you never know who they know or when you might need a good word from them to help you land your next job.
Here are a few tips to follow:
Give at least two weeks notice
Although some situations do not allow you this much time before you leave your job, always try to give sufficient notice to your employer.
Finish your current tasks
Complete any responsibilities that you have on your plate before you leave. This will not only help the person who will take over your position, but it will also help your co-workers complete their jobs effectively.
Speak to your boss about the situation
Be prepared to discuss why you are leaving with your boss. In some cases it might be uncomfortable, but being respectful will only make your departure easier.