Nations form alliances for different reasons. One could be because forming an alliance with a nation can form stronger bonds and promote trade - that's one good reason already, with stronger trade and a mutual relationship between two nations, both of them prosper.
Another would be a military alliance. Two nations can have the same enemy and neither can defeat him singlehandedly, for that reason they team up and try defeating him together.