Austria-Hungary wanted to impose rule on Serbia, so gave an ultimatum to Serbia after the assassination of Franz Ferdinand by Gavrillo Princip. Serbia actually accepted all but one of Austria's conditions (Which every other power in Europe, including Germany and Russia) thought was sufficient to avoid war. Austria, however, refused to accept Serbia's acceptance, and declared war.
Russia, which had a historic tie to the Slavic peoples in Serbia, issued a half-mobilization order for it's armed forces. Russia told Austria to cease hostilities with Serbia, and when Germany told Russia to cease mobilizations, Tzar Nicholas actually tried explaining it to his cousin, Kaiser Wilhelm, both of them expressing desires to remain at peace. They even signed their telegrams with "Nicky" and "Willy".
Unfortunately, German diplomats had other things in mind, and issued an ultimatum to Russia, stating that if Russia did not cease it's mobilization, Germany would mobilize against Russia. Russia didn't cease mobilization, and turned to France, which it had a treaty with. France, which wanted vengeance for the Franco-Prussian War of 1870, agreed wholeheartedly, and mobilized.
Austria sent troops into Serbia, Russia crashed into Germany and Austria, and Germany, wanted to fight a two-front war for as little time as possible, rapidly mobilized against France, choosing to march through Belgium to try to seize Paris as fast as possible. This enraged Great Britain, who had a treaty with Belgium, and Britain deployed it's army, the only professional army in Europe at the time.
The Ottoman Empire joined shortly after solely due to the war-hawkish actions of Enver Pasha, Italy joined the war in late 1915 to seize territory from Austria that it had claim to, Romania joined the war in September of 1916 after the massive Brusilov Summer Offensive shattered the Austro-Hungarian army for the time. The United States however waited until late 1917 after Germany began unrestricted U-Boat warfare for the second time, after Wilson had threatened war.
The United States WAS the reason the war ended when it did, since Britain and France had plans for 1919 offensives. Kaiser Wilhelm only agreed to abdicate because Woodrow Wilson had assured him that he, not the British or French, would be the one leading the peace talks. When Woodrow was given a minor role, THAT was when Germany got screwed over.
Sorry for the huge comment, but I am a Great War historian, so it makes me uncomfortable when the actual sequence of events isn't shown.