There is, as this CareerJournal article notes, a certain style that should go with leaving a job.
The two most important tips, I believe, are not burning bridges and not taking too long.
The first is crucial. Although it may be tempting to unload a few grievances about the efficiency or I.Q. level of certain executives, it is not wise. (As one observer noted with regard to another issue, "If you fire the boss's son because he's the dumbest person in the company, perhaps he was the second-dumbest person in the company.") Go with grace. Remember the maxim: All the brothers are valiant and all the sisters are virtuous. Trust me. You will cross the paths of some of those people in the future.
Go quickly. Two weeks notice and you're out of there unless you're the CEO and then perhaps you should make it a month. The point is you will rapidly become a ghost and if your departure is too long, people will begin to jump when they see you in hallways. "Are you still here?" will be the unspoken - and in some cases spoken - question. Don't kid yourself that there are megaprojects that need to be shaped up before you leave. The minute you announce your resignation, your clout on those projects will start to drain.
A word to those who receive the letter of resignation: If it comes as a total surprise, you haven't been paying enough attention to your employees.