You have to be in the Command division to work your way to the big chair.
Unless you are commanding a science vessel (like alternate future Crusher) you aren't going to captain a ship wearing anything but Gold (TOS) or Red (TNG). People can move from divisions, as we see on occasion (Worf started in Command, moved to Operations, then was moved back to Command when he transferred to DS9). This doesn't mean Crusher can never achieve the rank of Captain, but she would be a Captain in science, probably serving at a medical facility, and not as a captain of a star ship.
Examples of standard rank advancement:
In the Prime Universe, Kirk has a regular progression for being promoted, although somewhat rapidly. His whole history isn't known, however:
- He entered Star Fleet Academy for a five year officer training program.
- He was commissed as an Ensign sometime in the first half of the 2250s.
- He was promoted to Lieutenant in 2255.
- In the later half of 2250s he was an instructor (with the rank of Lieutenant) at Star Fleet Academy.
- Sometime between the late 2250s and 2265, he achieved the rank of Captain and was awarded command of the Enterprise from Christopher Pike.
In TNG you could look at La Forge:
- La Forge attended Star Fleet Academy
- He served as an Ensign aboard the USS Victory
- He served as a Lieutenant Junior Grade as Conn officer aboard the Enterprise-D
- He was promoted to Lieutenant when he became the Chief Engineer aboard the Enterprise-D
- One year later he was promoted to Lieutenant Commander aboard the Enterprise-D
Titles can be a little ambiguous though. If you are in command of a star ship, you are called the Captain, regardless of your actual rank. That is the same on Navy vessels, where you might be a Lieutenant Junior Grade in charge of a tug boat, but if there is another crew member, he will refer to you as captain.
How to be promoted:
People who excel at their jobs are often rewarded with promotions. In contrast you can look at the alternate time-line with Picard, where he never achieved more than the rank of Lieutenant Junior Grade as a science officer. This was because he was viewed as an officer who always played it safe, and never took risks that would get him noticed.
The other factor that can lead to rapid promotion is a war. If you have a lot of personnel being killed and a shortage of officers, you are going to need to promote people to fill key leadership positions.
In contrast, if you served aboard the NX-01, you never saw a promotion.