There are four widely recognized causes of World War I. They are imperialism, militarism, nationalism, and the alliance system. Imperialism is to seek to build an empire... to attain new territories and seek power and influence over other nations. Militarism is the build up of a nation's military power. Nationalism is defined as having pride in one's own nation. And finally, the alliance system is a web of national alliances and defense pacts that various European powers entered into in the late 1800's and early 1900's.
In short, these four items combined were a recipe for a war. As countries are assimilating new territories around the world, it was bound to come that two or more would argue over the same territory eventually. Given the fact that all of the major nations at the time were going through bouts of nationalism; believing that their country deserved to be a top nation, there would likely be strife between various nations. With regard to militarism, no country would spend the time, money and effort to create a massive military force unless they had intentions of using it. And last, but certainly not least the spider web of alliances that were made among all the imperial powers became so extensive that it would only take one skermish between any two of them to ignite a huge engagement among all of them.