Derek Jeter will likely play his entire career with the New York Yankees. LeBron James has already left one team, and might leave another soon. Both are Hall of Fame players that have had extreme success in their chosen professions. They are recognized as some of the most talented players in their sports. Why did one stay and one leave? Probably for a variety of reasons, but it seems more and more that organizations are realizing there is some value in the retention of their players and are trying to find ways to improve their success at retention.
In the business world outside of sports, we have much more freedom to change employers whenever we want. Most of us are glad we have that choice. Sometimes we move on when we don't want to, but in the majority of cases I think technology workers leave companies because they aren't happy about something.
There was an article about why the top talent leaves a company and I think it presents a number of issues that many employees experience within their own organizations. People aren't engaged, respected, valued, challenged, and more. In short, they really don't like their jobs. Many of the issues are often easy to fix, but only if you could fix two of the major items mentioned (#7 and #10). Those are leadership issues, often systemic ones that occur when upper management doesn't care about culture or doesn't make an effort to hire and train good managers.
I don't know if I'd prefer to see people in technology working only a few jobs during their careers, spending decades at each, or if we are better workers with the exposure to differing environments and businesses. All I know is that I am glad that I've had the ability to leave bad jobs in the past, usually because of bad managers.