Probably the single most important factor is family. If the military member is married, is the spouse supportive of a military career (the moves, the deployments, etc.)? If the spouse works outside the home, the couple will need to consider whether the spouse can continue his/her career. If the spouse is also in the military, they need to consider whether they can be stationed together and, if not, whether they can deal with that.
Other reasons are as cited above: desire to do something different than the military, desire not to deploy (whether single or married), desire to make more money, desire to get an advanced degree that is impossible or difficult while in the military, wanting to homestead (stay in one place) . . . and on and on.
BTW, do NOT assume that those who leave the military after 5, 10, etc. years are any less "loyal" to the service in which they served. Many former military types stay active in the Reserves and/or are active in veterans' activities, USNA alumni activities, philanthropy etc. They simply decided to take a different fork in the road.
In the end, everyone gets out. Some simply do it sooner than others.