How many Starfleet Captain's do you suppose are commissioned each year?(Late 24th century)
That's one of those questions that can't be answered without answering a bunch of other questions, like how many ships are there.
Or, it can be answered abstractly: Starfleet maintains enough Captains to fill all the jobs it wants filled by Captains, and promotes enough new ones each year to replace those who retire or die (and to fill new jobs created by expansion, if any). Not very satisfying, was it?
Off topic for a moment, how long does a Captain in the U.S. Navy command a ship, be it either a surface ship(all types included) or a submarine?
I don't know the answer, but I know some valuable clues:
Generally, promotion to O-6 (Captain in the Navy) is limited to people who have been in the service for at least 22 years.
Unless you get promoted to O-7 (Admiral), you have to retire after 30 years of service.
So, with the exception of rare exceptional individuals, nobody gets to be a Captain for more than 8 years.
Now, you don't need to be a Captain to command a ship: the US Navy has plenty of Commanders running cruisers, and probably some Lieutenant Commanders commanding smaller ships, so it is possible to
command a ship for much longer than that: a Lieutenant Commander may have been in the Navy for as little as 10 years.
Note also that an officer in the US military must retire at 62, regardless of rank or time in service, unless he has obtained a waiver signed by both the Secretary of Defense AND the President (IIRC)
So, we can see right away that Starfleet does things a bit differently: they let people stay Captains longer, they raised the maximum age (Tuvok was 112 and still on active duty), and they certainly don't force people out after just 30 years (Jean Luc Picard had been in Starfleet for longer than that before TNG began). One thing they apparently do the same is let Commanders have command of smaller ships.