Long-term Causes:
Militarism
Inflexible military plans and timetables were devised by military staff to be carried out in the event of war. These plans often conflicted with plans held by other countries, which lead to major prewar issues. For example, the French followed Plan XVII, which could basically be summed up by "attack!". German war plans, however, incorporated a fear of encirclement and avoided war on two fronts. It called for a swift knockout of France, followed by defensive action against Russia. They based their plans on the knowledge that Russian troops couldn't mobilize as quickly as the French, giving the Germans a few weeks to focus solely on the French. This plan came with many drawbacks, and made it almost impossible for there not to be a war.
Alliances
One of the main long-term causes of the Great War was the alliances that formed among countries. Alliances were meant to promote peace, however rival alliances became a major issue in the 1900s. The two most hostile camps were the Triple Alliance and the Triple Entente. The Triple Alliance, aka the Central Powers started off as the Dual Alliance (Germany and Austria-Hungary) but were joined by Italy in 1882, forming the Triple Alliance, whose main goal was to protect the political status quo in Europe. The leaders of other nations viewed this new alliance with suspicion, catalyzing the formation of an opposing alliance. On the other side, the Triple Entente consisted of Britain, France, and Russia, who all aimed to resolve colonial disputes.
Imperialism
The colonial conflicts and competition leading up to WWI were the cause of increased tension between major European countries. Nations searched aggressively for new colonies or dependencies to bolster economic performance. In the rush to colonize new land, the European powers ran into each other and repeatedly clashed with one another. The most severe and dangerous of these encounters happened between Britain and Germany (in east and southwest Africa) and France and Germany (in Morocco and west Africa). These clashes eventually spawned into the Great War, after many more confrontations between both situations.
Nationalism
Nationalism was the idea that peoples with the same ethnic origins, languages, and political ideas had the right to form sovereign states, also known as self-determination. After the French Revolution and following Napoleonic reign and conquests, nationalism spread across most of Europe. Although nationalism helped with the unification of larger countries like Germany and Italy, it was on the verge of tearing apart multinational empires such as the Ottoman and Russian dynasties. Nationalism in these places caused conflict between the government and the minorities who wanted to form their own countries. This aggressive nationalism was also tied to economic competition and colonial conflicts, fueling dangerous rivalries between major European powers. This competition and increased sense of nationalism was one of the main causes of the Great War.