One of the most important reasons that the First World War lasted so long was the failure of the Schlieffen Plan.
The famous German war plan aimed at avoiding fighting a war at two fronts by attacking France from the north, encircling Paris, quickly defeating the French, and then moving towards the eastern front to face the Russians who would not have been able to mobilize in time to help their ally.
This plan, however, entailed the German troops passing through Belgium to reach France and consequently violating the London Treaty of 1839 that guaranteed Belgium neutrality.
At the outbreak of World War I the Germans immediately put their plan into action but they failed to carry it out effectively. To begin with, the Belgians refused to let the German forces pass through their country and put up greater resistance than the Germans had predicted, managing to significantly delay them.
Belgian resistance also gave Britain the time she needed to organize her Expeditionary Forces, which were sent to protect the neutrality of Belgium and help the French.
Following the failure of the Schlieffen Plan, the war quickly developed into trench warfare in the western front, which was another significant factor for WWI lasting so long. Due to the creation of trenches and technological advances the defensive became a lot easier than the offensive, which of course guaranteed that there would be no swift victory by either side.