Most of the principal participants in the war wanted a war of some type for their own reasons but nobody could have wanted the one they actually got. Great Britain was the exception, having quite enough other irons in the fire in 1914, notably Home Rule for Ireland, a conflagration that did pop up the Easter Rising in 1916 in the middle of the war. The situation in the Balkans generally was incredibly fluid due to the retreat of the Ottoman empire and the attempt by the creaky Austro-Hungarian empire and the Romanov dynasty to move in on the territory, where nations newly created out of the Balkan Wars vied with the Austrians for possession of the turf. The Austrians simply occupied Sarajevo and dared anyone to do anything about it. The Serbs had experienced a bloody palace revolution that placed one party in and the other in a mood for revenge. It was the latter party who had the Serbian Black Hand, and they were fine with starting a war with Austria so that the ones they regarded as usurpers would get thrown out of government.
There was a peace faction and a war faction in Austrian government, and it was the head of peace faction, Francis Ferdinand, who got assassinated. The war faction deliberately made impossible demands and the Serbs acceded to all but one to keep peace. That wasn't what the Austrians had in mind.
What is amazing is how this one incident ballooned into Germany invading Belgium at the other end of Europe, not just that it happened but how fast it happened. There was a European diplomatic community that had been very successful in defusing such crises just prior to 1914, but it was overwhelmed by the speed at which events took place. The general view was that once mobilization started it couldn't be stopped, which was true of such nations as Russia and France, but as Barbara Tuchman revealed in her remarkable Guns Of August the Germans actually did have a plan for a partial mobilization and Moltke misled the Kaiser when he said it couldn't be stopped. "Your uncle would have given me another answer," said the Kaiser, some of the saddest words in history.
If Francis Ferdinand and his wife had lived and Frans Jospeh had died earlier WW1 might have been averted.
Why did the cowboy jump naked into the cactus?
It seemed like a good idea at the time.