The assassination of Archduke Franz Ferdinand the heir of Austria-Hungary took place in 28th June 1914 while he was visiting Bosnia, which is a Slav state. To my opinion the assassination was not the reason for the break out of the war, there are many other main factors, this is only the spark factor.
I think the main cause of the war is rivalry, there were rivalries between Austria and Russia. Austria had control to the black sea which Russia wanted to access to, Austria-Hungarian Empire included areas of the Balkans which Russia felt should be controlled by them. .
On the other side, there were rivalry between Germany and Britain, Germanys economy haws over took Britain, and they have started to build more ships and it is catching up with Britain, Britain was quite worried. And Germany wanted to extend their empire but both France and Britain wanted to get Empires in Africa. .
Before World War I there were other wars between each country, but they were short, one of them only lasted for six weeks. In the Franco-Prussian War in 1871, Germany had beaten France easily, the French gave two areas of land to Germany. The French were humiliated, they wanted Revenge. .
Russians and the Balkans are all Slavs; many of the Slavs in the Austria-Hungary Empire wanted to be independent, they speak languages that are closely related. Russia is the largest Slav state; they think it's their duty to protect the other Slav groups. .
Also the monarchs were afraid of the growth of socialism, people wanting to give power to ordinary people, lots of people agreed with it, the monarchs thought that winning a war will change how people think about it, they would think that their leaders are great and they would trust them and obey their orders, instead of wanting to give power to ordinary people.
Because of the rivalry, previous wars and politic reasons, each country see each other as a threat, they were afraid of going to war, so they introduced the alliance system, which they thought will bring peace and it would be more secure.