I've known two people that served in the US military, one in the Marines and one in the Navy. Both observed that officers and enlisted that worked closely with the CO moved up much faster than those that did field work.
It's actually the other way around. The boss (CO) sees people who have potential, and moves them into positions next to him. They didn't get there by accident.
How did he see that potential? Because they were good to start with, and visibly demonstrated that potential.
To continue to move up, you need a wide range of experience. Field, staff, joint, classroom...