I'd like to attempt to answer this question myself. I'm in a kind of ambivalent situation: I'm a developer, but I am also a co-owner of a company. So I am very interested in understanding what drives developers away.
I can tell you that it is not easy job being a good employer. You have to consider so many things, and satisfying all your employees' needs is a very hard task under certain circumstances.
I am a little surprised that many answers picture a hostile relationship between companies and leaving employees. My experience is that (young) people who go away in many cases are looking for new challanges, maybe leaving for a job in a foreign country. This doesn't imply that the job at your company was a bad experience.
To people who contributed much to the company's success, I always try to tell that it was hard letting them go, I wish them all the best for their individual future.
Then, there are some practical aspects: there are some legal things to emphasize, e.g. a reminder for non-disclosure agreements, email-forwarding for some time, asking them if it was okay if they could be contacted for possible questions etc.
Another aspect is that exit interviews provide an opportunity to 'make peace' with disgruntled employees, who might otherwise leave with vengeful intentions.