It's a bit depressing when good folks in your organization go off someplace else. There are various things people talk about in terms of why someone 'actually' left. Either ways, one thing to realize is some people will eventually leave irrespective of what you do to retain them and also that some churn is good.
There are various dimensions around attrition and retention. There's also a lot of analysis done by employers to know reasons and trends around why people quit, what's the average longevity, what experience levels quit more than others and so on. It's actually a fascinating bit of analysis to try and put your finger onto something.
To your disappointment perhaps, I won't provide any specific analysis here. What I will tell you though is something from my experience. Most people have some ongoing frustrations with their work, work environment, manager, colleague, salary, opportunities etc. The decision to move on is taken at a time when one or multiple such factors start reaching unmanageable proportions. Now, there are also some things that make people stay back - not so strangely, a lot of the factors for staying back or quitting are generally the same eg. you may quit or stay because the work sucks or work is really great; you may quit or stay if your salary is pathetic or is really good; boss is evil or an angel (huh!) and similarly with other considerations. It's an ongoing battle, a see-saw. If too many of these factors turn negative and too few positives remain, the chances are high that the person will quit. Some of the factors could be real and some may also be perceived reality but if the employer can't change the perception, that's as good as real.
Now, one of best ways in my view to retain people is to keep them busy with some good work. A lot of other factors stop playing a big role when folks are busy. It may seem too simple and some of you may disagree but think about it yourself. How many times have you proactively looked out for a job when you were absolutely busy doing work that you didn't particularly dislike (hopefully even enjoyed?) To a certain extent it goes back to Maslow. If your basic needs are met and you're generally doing ok with your finances then you're possibly working for something better than just making ends meet. If you are busy with meaningful work trying to achieve something and feel your peers and company value what you're doing, you tend to carry on.
There are different people and different circumstances so no one reason for attrition or retention would be universally applicable. However, if the mind is busy and focused on achieving something useful, there's lesser time to think about other things - including quitting!