When Bismarck succeeded in establishing a new Deutsches Reich, he was very well aware that it was a) too powerful to be a welcome neighbour, b) not powerful enough to effectively control Europe and c) vulnerable only to an attack from more than one side.
So, he decided to a) establish bilateral contracts and treaties with all the major powers in Europe to make an alliance against the big guy in the middle less desirable than partnership (that idea he “stole” from Britain) b) bring forth a hegemony that would make Germany essential to Europe’s well being (he knew that this could only be done by economic means but, unfortunately, he didn’t know how to do it) and c) keep France and Russia apart.
His successors were less aware of the benefits of his policy of balance and less able to transform it into politics; they didn’t realize that the somewhat hegemony that Germany had established depended on it and, worse, they even managed to bind the country to the decisions of allies that were politically unstable and militarily weak.
The brilliant and realistic Generalstab under Helmuth Karl Bernhard von Moltke had known that a two-front war was more than dangerous and they had supported Bismarck’s point of view. But the new generation of military leaders had less political insight and they had become used to the idea that the German military was the best and could achieve what economics and politics failed to do (might sound familiar to Americans).
When it became clear to the military that Germany “had to” fight a two-front war, if it came to one (and they didn’t even consider the possibility that it wouldn’t come to this – and some were, in fact, glad that the opportunity for war was arising), they decided to win it.
So, the armament race was accelerated.
The new emperor was too stupid to understand the implications of the new direction of a militarily guided policy and the leading politicians either supported it (some well aware that they had failed) or were (still) to weak to do more than keep it at bay.
What Germany, well, all of Europe lacked in the years prior to the war, was any will to prevent it. All major powers had come to the conclusion that it had to be done; the questions were: when and why?
Some situations had been defused before the year 1914 and there had been a pretty good chance to moderate that one as well, but, ultimately, I think, they would have gone to war regardless.
But, who knows? The SPD and other democratic parties were gaining more and more influence over Germany’s politics and they had no interest in war (the gradual shift to a more parliament controlled state was well on its way and was threatened by a war that would inevitably invigorate the more and more sidelined aristocratic side). Austria-Hungary and Russia became less stable every year, Britain had more to lose in a war than to win and though France wanted the war at least as much as the German military, there were influential political forces that were far too realistic to start one.
Anyways, after the war, the “Kriegsschuldfrage” (who was to blame for the war) was discussed heatedly in Germany. The majority of the political players and the people were well aware that they had done far too much to bring war on its way; but the Treaty of Versailles was considered grossly unfair by all parties and people alike and it helped to shame the reasonable persons into silence in the public discourse while it gave the deniers an easy target for their ire.
The deeply felt injustice of the Kriegsschuldfrage was one paving stone for Hitler.