The first step you should take when considering how to quit your job with dignity, is to make sure you are entirely sure you are ready to move on. A half hearted resignation letter will do you no favours when looking for a reference. Make sure you have in your mind clear reasons for why you wish to quit, and from here you will be able to offer a justification to your employer for your resignation. Having a valid reason to present to your employer will help to ensure you retain their respect. Remember, it is very useful to retain a good relationship with your employer as a strong reference can make or break your next job application.
Once you have decided that you are entirely confident you will be quitting, do not tell anyone at work until you contact your boss. It will appear highly unprofessional if the news gets to your boss through a series of Chinese whispers. If possible, have a date of departure in mind to give your boss before you approach them. It is best to tell them of your resignation through a formal letter. The written form of correspondence allows you time to carefully construct your reasoning and articulate yourself competently. It is also polite to have a chat with your boss, so as to reflect upon your time at the company, what lessons you will take with you and to discuss your future steps.
It is important that you give your boss sufficient notice before you decide to leave, ideally four weeks. Your boss will need time not only to find a replacement, but to train this replacement. They may even wish for you to provide this training, so be as considerate as possible in your circumstances regarding the time frame between your resignation and departure date.
Do not take your resignation as your opportunity to voice your opinions on your colleagues or your boss. This will simply reflect badly on you. It is likely to result in an unprofessional reputation being created for yourself, and may even result in a bad reference, which will massively hinder your future job applications. Leaving a job, particularly if you have made strong bonds with people or have been with the company for a long time, can be a very moving experience. Try to leave any overly emotional displays for a private setting, to avoid making people feel uncomfortable. Focus on why you have chosen to leave, and remember resigning should be YOUR choice.