Warnings
Allowing a boss you have disliked to needle you into insulting him or her will end badly. You don't want to end up being escorted off the premises by security. Don't give in to the temptation to say what you really think if it's negative.
Some bosses don't take kindly to you being "the decider." Be sure you can truly afford to walk away from your job that day, because sometimes the supervisor takes it very personally that you are leaving, tell you there's no need to give notice, and instruct you to leave immediately. You will be the best judge of this, so do your best to assess if your boss is one of these people - but be aware, sometimes, you just can't predict what anyone will do. Re-read your employment contract - you must be aware of all the company's and your own termination options. If there is no formal employment contract, familiarize yourself with the default provisions of your state/provincial law.
Be physically prepared to walk away that day: before resigning, save to disk or email to a private account anything you need and have the right to take such as contact information for clients, suppliers or other references; work samples; a list of projects you worked on, etc. [Keep in mind, much of the information and other items you had access to while employed are frequently proprietary and owned by the company. Make certain it is within the bounds of your contract and the law before you take this advice].
When considering a counter-offer, honestly evaluate why you want to leave - and protect yourself. While a raise might be nice, it might not solve other issues that require either a promotion (if your job advancement has stalled) or a transfer to another group (if you have personality conflicts with your boss). You can protect yourself from being vindictively fired later by demanding that, for at least two years, you stop being an "at will" employee and can only be fired "for cause."
A counter-offer is sometimes made because the employer has no one else available who is able to do your job. If that's the case, and you take the counter-offer, they will probably ask you to train others to take over your position. You may end up unwittingly training a replacement, only to find that the next change is not on your terms.
A counter-offer (if it's a raise only) may be an acknowledgment that you are being underpaid. (It may also be that your employer realizes that an investment of more money in you now will save them the expense of training and lost production while a replacement is trained and brought up to speed.) If you're being brought up to a proper pay level only under threat of leaving, you will likely have to face salary negotiations (or resigning) again in the future.
Be aware of any types of benefits you may be eligible for. If you are about to be laid off, you may have a severance package, or the option to collect unemployment benefits. These can be very handy if you have not secured a new job. Resigning from a position may disqualify you from receiving anything. It may be better in some cases to receive these benefits while looking for your next position.
DO NOT get into a complaint session with your co-workers before you leave. Behave as if you were returning as normal, and every negative thing you say will get back to the boss or to the person you complain about. Again, you never know when these people will resurface in your career. If you have to have a venting session, do it only with one very trusted co-worker. Save it for after you are gone - and definitely, do it away from the office.
Don't let your emotions get to you.
Concluded