Austria- Hungary allied with Germany to get revenge from Persia. Serbia allied with Russia for the assassination. Russia allied with France, Serbia, and Britain for the assassination. France allied with Russia and Britain because they were scared of Germany. Belgium was neutral, but invaded Germany. Britain allied with France and Russia because they were furious of the invasion of Belgium.
Germany's Militarism & France's Hatred
Pan-Slavic was the thought that all Slavs were the same, no matter the borders of geography and language. Nationalism caused the assassination of Archduke Franz Ferdinand. Nationalists wanted to get Austria-Hungary away from the Balkans for a "Greater Serbia." Since, Serbians thought they were better than everyone since the killings of the Archduke.
On June 24, 1914 Archduke Franz Ferdinand and his wife were assassinated by terrorists called "Black Hand." All nations we're already ready for war, but their breaking point was the assassination. It was as if everyone was done with eachother's nationalism and wanting to be better than everyone else, and since the assassination was a terrorist attack strengthened the Serbian nationalism.
Germany wanted to be bigger and better than France in everything. They wanted to prove who was in charge and wanted to dominate France for good, since they've been enemies for a long time. Their nationalism, militarism, and greatness fueled France's hatred even more. France wanted to go to war with Germany still, so they made alliances.
There were two mainstream alliance groups. The Triple Entente, which is good, and The Central Powers, which is bad. Both were trying to dominate eachother and be better than eachother. This created a rivalry and even more tension, which led to nations going to war and their alliances as well.
Every nation wanted to be dominate of eachother, so the larger nations would take over the smaller ones. Just like bigger kids bully smaller kids. Germany and Britain were expanding their army like crazy and couldn't be stopped. Everyone just wanted to be bigger and better, and be at the top of everyone.