WWI was a 4-year war that claimed 22,000,000 lives. While it was a truly damaging war, there were many reasons that it began, which made it very difficult to avoid. Since it is called World WAR I, it obviously wasn't avoided.
After England got the most land in Africa during the Berlin Conference, other countries (and England itself) attributed it to their military power. As a result, almost every industrialized country was building up their own military, or practicing militarism.
Many world leaders could feel that war was imminent, which is probably why so many alliances were struck. Also called Defense Pacts, these agreements said that the involved parties would help the other in fighting any war that one of the countries became involved in. It became like gangs but countries instead; if you start a fight with one, the others are going to come after you.
Nationalism is when people of a country (normally citizens) want their country to be the best or believe that it is. It is comparable to sport fans.
The chance to imperialize served as icing on a lemon for those countries who partook in WWI. Imperialism is when a dominant country takes over another, weaker country in almost all ways (socially, politically, and culturally) . This allows the dominant country to use the weaker country's natural resources.
Although the world had been in prime condition for a war to break out for some time, the assassination of archduke Franz Ferdinand, leader of Austria, and his wife, Sophie, was what started it all. Once he was killed and Austria-Hungary and Serbia went to war, all of the other mentioned causes began to take place and became more useful (militarism is definitely useful in times of war).