The war was fought between two military alliances (or leagues): the Delian League headed by Athens and the Peloponnesian League headed by Sparta. Initially the two military leagues were established to defend the Greek mainland against incursions by the Persian Empire. However, as the power and influence of Athens grew after the second Persian War (480 - 479 BCE), the members of the Peloponnesian League grew increasingly fearful of Athenian expansion in the Aegean and Adriatic seas which threatened to curtail their economic power. The polis of Corinth was especially threatened as they were the main navel power in the Peloponnesian League and had the most to lose from Athenian expansion.
Although Athens had the upper hand throughout much of the 30 year war, mismanagement and partisan disputes in the Athenian democracy ultimately led to their defeat in 404 following the battle of Aegospotami.
Following the war, Athens would be ruled by a self-serving and bloodthirsty oligarchy (known as the 30 Tyrants) from 404 - 403. In 403 the oligarchy was overthrown and the democracy was reestablished. The trial and execution of Socrates would follow a few years later (399 BCE) and may in part be traced to the disastrous events of the war which saw the end of the Athenian Empire.
Read more about the Peloponnesian War.