Usually a state’s capital is based on a number of factors, including centricity within the state, importances as a business/trade center within a state, or overall suitability to serve as the seat of government.
The state I live in, Michigan, is an interesting example case of how state capitals are chosen:
Currently our capital is Lansing (hope you already knew this), but as late as 1847 Detroit was the capital of Michigan – after all, it was the hub of trade and business, had the considerably largest population in the state, and had easy access to Great Lakes ports and connected directly to Canada.
But….Detroit was a problem: It was too powerful, not at all centrally located in the state, and it was vlunerable to British attack and capture (Detroit had been captured by the British from 1812–1813).
So State powers that be held a conference to figure out another city to name as capital. Cities such as Ann Arbor, Jackson, and others vied for the title. But since none could agree, out of frustration the State picked this little po-bunk town of nothingness named Lansing. It was (relatively) centrally located in the state, far from danger, and seemed politically neutral.
And that was how a capital was born.