The best way to remember the causes of World War I is by using the acronym MANIA: Militarism, Alliances, Nationalism, Imperialism, and Assassination of Archduke Franz Ferdinand.
Let's start with Militarism, or the arms race. Militarism is the glorification of the military. War seemed like a certainty during the years of the early 1900s, so Germany decided to increase their naval strength to rival of Britain's. Since Britain had the strongest navy at the time and wasn't about to let Germany rival their strength, Britain began increasing its navy. This, along with the rivalry on land between Germany, Russia, and France, led to much hostility between many European nations.
Alliances were also a major cause of World War I. In 1882, as war was looking more and more like a certainty, two major alliances formed. The Triple Alliance consisted of Germany, Austria-Hungary, and Italy (Italy would not fight with Germany and Austria-Hungary however) because Germany wanted to protect itself against France taking revenge for its losses in the Franco-Prussian War. When war broke out in 1914, Germany and Austria-Hungary made up the Central Powers. On the other side, the Triple Entente was formed by France, Russia, and Great Britain. Alliances allowed leaders to act more boldy than they would if they were alone. They knew with these alliances that they had powerful allies backing them.
Nationalism is extreme pride in one's country. Nationalism was strong in France and Germany. in 1871, when Germany was expanding its empire, France was defeated by Germany and lost the iron-rich territory of Alsace-Lorraine. France wanted it back since they felt it was rightfully theirs. This led to much hostility for years between Germany and France. Pan-Slavism also emerged. This was the idea that all Slavic people shared a nationality, so Russia, being the largest Slavic country, stood ready to defend the new Slavic nation of Serbia. Austria-Hungary and Ottoman Turkey were threatened by Serbia because they were worried Serbia would try to take some of their land to unite the Slavic people in the south.
Imperialism is when a stronger nation takes over a weaker nation, usually for economic reasons. In 1905 and 1911, a war between Germany and France almost started over Morocco, which was controlled by France. The more territory a country controlled, then the more powerful that country appeared to the rest of the world, especially economically. This also ties back into militarism as these countries that controlled overseas empires needed to strengthen their military to keep control of them.
The assassination of Archduke Franz Ferdinand on June 28, 1914 was the spark that led to the start of World War I. Ferdinand was the heir to the throne of Austria-Hungary, and on this particular day, he went to Sarajevo in Bosnia. Some Bosnians were Serbs who believed that Bosnia belonged to Serbia. A man by the name of Gavrilo Princip, a Serb, shot and killed Ferdinand after Ferdinand's driver made a wrong turn. Because of the death of their heir to the throne, Austria-Hungary sent an ultimatum to Serbia. Since Serbia did not agree to all of its demands, Austria-Hungary declared war on Serbia. The alliance system then led to a chain reaction of countries declaring war on the allies of their enemies. This was the start of World War I.