This is a very loaded question. It's honestly not clear that alliances are the greatest cause of large-scale wars. (What about ideology? Economics? Geopolitics?) But there are a few reasons why they may contribute to them.(1) Alliances can transform a small skirmish into a global war. The most basic...
This is a very loaded question. It's honestly not clear that alliances are the greatest cause of large-scale wars. (What about ideology? Economics? Geopolitics?) But there are a few reasons why they may contribute to them.
(1) Alliances can transform a small skirmish into a global war.
The most basic kind of alliance is a defensive pact; it basically just says that if someone attacks you, I'll help defend you, and if someone attacks me, you'll help defend me. When these types of alliances are in place between many countries, a small conflict that could have remained between two minor countries can quickly spread to others, as the first country invokes an alliance with the second, the second invokes an alliance with the third, and so on.
This seems to be what happened in WW1, where a relatively minor triggering event (the assassination of a single relatively unimportant official) eventually escalated into the largest war in history up to that point.
(2) Alliances create natural antagonists.
When much of the world unites into a small number of competing alliances, those alliances begin to seem like natural enemies where previously the situation seemed much more complex.
If you have a situation like we had in the Cold War where most of the world was being absorbed into either NATO or the Eastern Bloc, rather than having the complexities of Germany interacting with France interacting with the US interacting with the UK interacting with Russia interacting with the Ukraine interacting with China, we instead had (or seemed to have) two huge, monolithic entities: NATO on the one hand, and the Eastern Bloc on the other. The complex interactions of many states were effectively reduced to one single global conflict.
On the other hand, the Cold War never did actually erupt into full-scale war.
(3) Alliances can disrupt the balance of power.
If there are many different countries, each with roughly the same amount of military power, there is a balance of power in which no individual country can dominate the others; any that try to do so will quickly be outnumbered and overwhelmed.
But if alliances form between some of the countries, a single alliance can become powerful enough to break this balance of power, gaining enough advantage that they can seriously hope to take several other countries at once. If this happens, the new dominant alliance may decide to start a war to conquer other nations and absorb them into the alliance.
(4) A global conflict by definition requires global powers.
This may be the most fundamental. Before the alliance system that linked dozens of countries in the 19th century, we did not have a time without war. We had a time with many wars, all going on simultaneously, but they were disorganized, only loosely connected to one another. Individual leaders had individual grievances and fought individual wars; the total amount of death going on at any given time was basically the same, but because it was happening in different places for different reasons among different people we didn't think to call it a "world war". We only started calling things "world wars" when there were alliances large enough to link deaths around the world into a single unified conflict.
This is also part of why the question is so loaded; alliances may not actually be the source of these wars at all, but simply the reason we call them "global" instead of thinking of them as a bunch of little wars going on at once.