Relations between the Kingdom of Serbia and Austria-Hungary were already not good before the assassination. The assassination was also committed by a Serbian nationalist. Since Serbia didn't agree with some of Austria's investigation policies, Austria went to war. Germany sided with Austria, because they were close allies and Russia sided with Serbia because they were both Slavs.
Hoped this helped