Four millenia ago, the civilized world was dominated by the great bronze age empires. The Hittites ruled an empire stretching from the fertile crescent to the Bosporus; Egypt was a bronze age superpower; half way around the world, ancient China was unified under the Shang dynasty. These empires had similar political organizations: a ruler that was more than an ordinary king - an emperor or great king or god king - ruling through a well established bureaucracy, supported through exhaustively recorded taxes, maintaining his rule through large, well organized armies centered on elite warriors on chariots, usually led in war by the great king himself.
At the end of the bronze age, these empires collapsed, and were followed by a dark age that lasted four centuries. Throughout the following iron age, the world was dominated by relatively small kingdoms. Even when the Roman empire eventually rose, it never achieved the centralized control of the bronze age empires; rather, it maintained its trade empire largely by granting a high degree of independence to its territories.
Why the difference? Why do we have tablets showing that the central governments of the bronze age tracked taxes down to the individual farm, while in the iron age, anything larger than a small kingdom delegated authority through some form of feudalism, giving nobles and governors a free hand in the management of their territories?
The answer lies in the differences between the military technologies.
Bronze age weapons were made of bronze - an alloy requiring both copper and tin. Copper and tin are not common in the earth's crust, and deposits are widely spaced geographically. For a state to be able to manufacture weapons at will - necessary to avoid destruction at the hands of invaders - it had to have access to both copper and tin; with such access, it could claim large expanses of surrounding land. The Hittite empire arose near sources of copper at Isuwa and of tin at Kultepe, both in what is now central Turkey; the Shang dynasty was named for their copper and exploited nearby small sources of tin in the Yellow River valley, allowing them to expand until they had trade access to the much larger tin deposits of what is now southern China; Egypt's Nile river connected copper mines in the Sinai with tin sources near Aswan. Control of the ingredients for bronze allowed these empires to expand until they ran into other empires with similar resources; thus, the Hittites and the Egyptians expanded until they met in the Levant, battling over a constantly shifting border there.
In constrast, iron ore deposits are common - iron is hundreds of times more common than copper in the earth's crust, and more than 10,000 times more common than tin - and iron does not require alloying elements. Locals could easily manufacture their own arms for a rebellion against a distant central government. As a result, the natural political organization changed in the iron age, from large central governments to small local governments, either in the form of independent kingdoms or principalities, or as territories of an empire with a high degree of independence.
Throughout the iron age, however, local power was usually still vested in a military elite, and the ruler was still usually a military leader, for the same reason that had been true in the bronze age: the weapons were melee weapons and bows, which required strength and years of training to use effectively. Armies continued to be composed of specialized warriors comprising a small fraction of the population. The common man continued to be a subservient peasant or slave.
That changed with the invention of firearms. Now, any person could become militarily useful with minimal training and a firearm. The common man, previously useful to the state only for producing food or other goods, was now also useful in war. And since it was not possible to put a firearm in the hands of the common man without his becoming a threat to the elites, the elites ceded political power - by choice or force - to the common man, in the form of democracy.
The Civil War serves as a good illustration of the connection between democracy, firearms, and strength in war. The Confederacy's slave population did not have the voting franchise, and was kept disarmed for fear of revolt. That meant one third of its population could not be drawn on for service in the army. The Union did not face the same constraints, which contributed to its victory in the war.
Expansion of the voting franchise paralleled increases in the size of wartime armies. Great Britain, for example, had a peak of about 3% of its population under arms during the Napoleonic Wars. Subsequently, the first Reform Act extended the voting franchise to about 10% of the adult population and began the process of distributing parliamentary seats in proportion to population. The franchise was further extended in several stages over the following century. At the end of WWI, in which Great Britain had a peak of about 10% of the population under arms, the franchise was extended to almost 50% of the population, including most adults, with subsequent extension to all adults.
Many people blithely assume that democracy arose through a natural progression toward more advanced forms of government. However, the pendulum swing from bronze age bureaucracy, to iron age decentralization, and back to modern bureacratic government, shows that advancement is not a clearly unidirectional arrow. The actual reason we moved to democracy was because firearms democratized martial power; political power merely followed.