In the current state of the economy, people are more likely to leave their employer due to layoffs than because they found a better opportunity. But both situations present similar issues and actions though.
First, you have to realize you have two roles within every company: you are both an employee, and a worker. What's the difference? And employee entails all the overhead stuff, the paperwork, compliance issues, EEOC training, getting paid, 401(k), and if you live in a magical fantasy world you even have a pension. For this role there is either someone in HR who nags, I mean helps, you with this (it could also be your supervisor). The worker role is your real work, your day-to-day responsibilities of getting stuff done. You deal with your supervisor, co-workers, and maybe even people you manage.
Job number one when you leave a company is to take care of the all your HR stuff. Make sure you have the names and numbers for your benefits people. Know all your account numbers and log ins for your 401(k), know who you contact if you want to roll any of this over.
Make sure your papers and emails are in order. You are reasonably allowed copies of your work papers, but be cognizant of your Intellectual Property restrictions. Don't take anything that is proprietary. But you are allowed to have access to various HR records, and you should always have had a copy of your performance appraisals. These will be key later on, especially if you have to tweak your resume, remember any awards you won, etc. If you receive pay statements via email, forward those puppies on to your personal email. You may wish to create a totally new email address for this, but I created a specific label within Gmail for this.
Now as a worker, it's a totally different set of responsibilities. If you manage any people, they have to be your number one priority. You'll need to have a transition plan for migrating your duties to whomever is taking over. In an ideal world, you will know who this is, have a positive working relationship and do this personally. Often times, you will not know who is taking over and there will be no chance to even talk to them about the team.
I went to great lengths to try and not bias the two people who took over for me. I was really handling two roles, and my boss wisely decided to split them apart and have two people take them on. I was upfront and always said, "Here is fact, here is my opinion". We called it a "Bus File", others call it a "Titanic file" or other permutations, but this was a document that summarized my roles and responsibilities, the basics of what I did, when certain deliverables were due, and gave some history on the most major pieces of work. I used this whenever I took a vacation of more than 3 days for whoever watched over my team as well.
Close out as many tasks as you can, be cognizant of whoever is taking over for you when new duties are assigned and try to push out the due dates so the new person can meet the deadlines. Make sure you let your replacement know what balls are still in the air.
And above all, never burn a bridge. You might want to take some cheap shots at people as you are leaving, really letting them know what you think of them. Don't. Just grin and bear it. However, one caveat is that you should be brutally honest should you have an exit interview. Mine was a joke, near useless. But I still was honest and told them what I liked about the company, why I was leaving, and what they should fix. The lady doing this pressed me on why I was leaving, which in part was salary. I wouldn't tell her the dollar amount I left for, but gave her a percentage range of increase and she laughed and told me I made the right decision.
I took a cue from my wife and handwrote thank you letters to people who really helped me out. I thanked those who gave me a chance to interview for promotions, especially one's I didn't get. The opportunities were great, and they didn't have to include me. I thanked all my supervisors for their wise council and mentorship. And I thanked one guy in particular for his frank and honest opinions on my work. He was a pain in the butt a lot of the time, a jerk to people who couldn't handle him well, but he was the most honest boss I've ever had. When I gave him work that didn't meet his expectations, he told me. But he also helped me fix it, which was key. I learned a lot from him.
The golden rule in this instance is twofold: treat people the way you'd like to be treated, and keep the future in mind.