Sometimes you love your boss, your coworkers, and even the company, but the right opportunity comes along and it's time to move on. In that case, quitting may be sad, but it's not overly difficult. You simply make an appointment with your boss, deliver the news, maybe shed some tears, and then go about productively serving out your (at least) two weeks' notice.
Leaving a job under less pleasant circumstances can be more of a challenge. Maybe you just dislike your boss; perhaps you hate everything about the company, every person there, and anything else about the job.
Even in that situation, it's very important to quit professionally. You may not want to, and telling everyone off might seem like it would be satisfying, but it would be a very shortsighted move.
How to quit your job
Be formal about it. Make an appointment with either your boss or human resources. Tell them you are leaving and make it clear what your last day will be. Ask any questions you have about last paychecks, exit interviews, remaining vacation days, and other benefits.
You need to be calm and professional. What you don't need to do is share any information as to where you are headed. It's fine to say "I've decided to pursue another opportunity" without offering specific details.
It is, however, important to be ethical. If you're going to a direct competitor and your current company may not want you to remain for two weeks, then disclose enough information to give it that choice. Your goal is to be as fair as possible to your employer even if it does not deserve that treatment.
Why quit well?
The benefits of telling your boss off or quitting in a blaze of glory are that you feel good for a moment and have a story to tell -- where you come off as a jerk. Doing things the right way may be less satisfying, but it's less likely to come back to bite you.
You may dislike the company, but you never know where a story might travel. It's never good to be recognized down the line as the person who (figuratively) blew the place up on the way out.
Can you be honest?
Larger companies will have exit interviews with human resources; smaller ones may do the same thing less formally. You can be honest -- to a point -- in an exit interview. It's OK to say you didn't think your boss "had a management style that encouraged hard work." You should not say that your boss "was a jerk who hogged all the credit and was mean for no reason."
Be constructive. Stay professional and try to remove your personal feelings from the process.
Go with a clean conscience
Save the venting of any anger for your close friends and family. Get it all out where it won't hurt you or create problems you can't even see now.
Leave a job well, and you're free to start your new position without worrying that fallout from leaving your last job will follow you. That's going to be best for your career in the long term.