While it might be tempting to quit in anger or to let your boss know exactly what you think of him or her as you exit in a blaze of glory, that's always a terrible idea. Instead, no matter how much you want to make your exit memorable, you should resist those instincts.
Even if you work for terrible people at an employer that treats you poorly, it's still important to quit professionally. Leave the drama for country singers and handle things the right way. It may not be satisfying, but it will serve you well in the long run.
Give proper notice
In most cases, the correct amount of notice is two weeks. There are professions, however, where a longer term applies. If, for example, you're a teacher, it's generally expected that you would quit at the end of the school year or at least when a semester ends.
Follow the norm for your field and notify your boss in person. Give two full weeks starting the business day after you give notice. If you have any days off scheduled during that period, offer to extend the notice period by the number of days you're taking off.
Close out your work
If you have any special projects under way that would be hard to hand off, you should work to complete them. That includes any one-time work that would take someone else longer to take over than it would take for you to finish.
Prepare a hand-off document
Unless you work in a field where lots of people are doing the same thing, it's likely you have some knowledge or responsibilities that others may not know about. Sharing this information could be as simple as putting a document together listing what you do each day and sharing passwords or anything else someone new might need to know.
Do this from the point of view of whoever takes over your job. Think about what it would be like if you were in that situation and provide whatever you think you would want to have.
Keep it kind
Inside the office, don't badmouth your current employer on your way out the door. Even if you want to say "I'm leaving because the pay is bad and we're treated terribly," keep that to yourself and say "I'm moving on to explore new opportunities."
What you say to your friends at home is a different story, but remember that even sympathetic co-workers may not feel the same way. Even if they do, being negative as you leave serves no purpose other than making them feel bad for having to stay.
Why do I need to do this?
While your employer may not be the best, you never know who you'll meet at another job. That story you have about quitting by telling the boss off, and then ripping the company logo off your shirt, may make for a nice tale, but future employers won't view it well.
Leaving the right way, even from a bad job, avoids burning bridges. That could be useful if you need a reference or if you encounter someone else from that company down the line.
Do the right thing, and you protect yourself. It may be less than satisfying and lead to an uncomfortable few weeks, but it will serve your career best.