Capital cities serve as the center of government for a state, with politics and economic growth usually weighing heavily in the location choice. The United States has 50 states, the Federal District of Columbia, and several territories. Washington, D.C. is outside of any established state boundaries, and none of the territories are officially states.
In a lot of states, a city may not seem like an ideal place for a capital, but many of them were determined more than a century ago. For example, Dover was chosen as the capital of Delaware in 1777 because its location provided protection from British attack.
Cities are often in pivotal locations when they are chosen, even if the location is not relevant in modern society. Tallahassee was between Florida's two largest cities when it was chosen as the capital in 1824. In the years since, Miami has become the major city in the state. Similarly, Chicago is the most populous city of Illinois, but the state's capital is Springfield. In 1839, when Springfield was chosen, Chicago was newly incorporated. St. Louis was the first capital of Missouri, but when it became a state, Jefferson City was chosen as its capital in an effort to develop that area.