History books used to tell you Archduke Ferdinand was assassinated and this compelled Austria-Hungary to demand ammends from Serbia, which were unmet, forcing an unwilling Austria-Hungary to declare war on Serbia and thus cascade into an unwanted war.
The Kaiser, always feeling inferior to his counterparts in Russia and Britain, began an arms race with Britain, building a massive army and a navy to rival Britains dominance.
With Britain and Germany playing "who's is bigger" , France and Russia too felt compelled to keep up or risk being overrun. Austri-Hungary, on a MAJOR decline from separatist movements, etc. caused by a split governed empire, was simply riding Germany's coattails, feeding off of it's bigger brother
This massive arms race devastated the treasuries of all nations, especially Germany and HAD to come to a head. Diplomacy had been able to effectively avoid war for years, leaving governments forced to answer questions about the massive spending and feigned threats of the British or German menaces.
The assassination of Archduke Ferdinand created a convenient excuse. Germant IMMEDIATELY delcared COMPLETE support for Austria against Serbia (a territory it had wanted to annex for years). Austria issued a series of harsh demands to Serbia, which were met almost 100%, BUT because something HAD to break, Austria found the concessions unacceptable and declared war, Germany followed, and Russia (pressured by France to uphold it's treaty with Serbia) declared against Austria and Germany, France and Britain immediately followed along with the Ottomans.
The rest is history.