There were two main alliance systems: the Triple Entente and the Triple Alliance. These were the primary political relationships leading to the war's early escalation.
The Triple Alliance was formed first, between Germany, Austria-Hungary and Italy. This was one of Otto von Bismarck's early efforts to establish the newly-unified Germany as a strong political entity with clear political avenues, and maximizing its alliances and minimizing the chances of a multi-front war was one of his priorities. The Alliance was drafted as a defensive measure, and this later caused a schism with Italy that led to its failure to abide by the terms of the alliance during the war.
The Triple Entente was the corresponding alliance between Britain, France and Russia, created at least partially in response to the Triple Alliance, and strongly encouraged by the end of hostilities in Asia between Russia and Britain, leading to a renewed focus on European politics.
While it is sometimes argued that the two alliances "dragged" multiple nations into the war, as if they were forced to do so against their will, when in fact the reasons were more complicated. For example, Britain was more strongly motivated by direct negotiations with Germany over the latter's invasion of Belgium, and to a sense of commitment to France.