Military alliance
A military alliance (usually just called an alliance) is a diplomatic agreement where two or more countries agree to mutually support each other in wars. Alliances are different from war coalitions, although war coalitions are formed from alliances.
Alliance Membership
Every alliance has one particular member which is its leader. The alliance leader controls alliance membership: it is the only country which can invite new members, and the only country which can eject members. It also will typically become the coalition leader in war, thus being able to control the terms of peacemaking.
Forming alliances, inviting new members, and banning members are all diplomatic actions open to the alliance leader. Non-leaders can ask a leader to join its alliance (if they are not currently in an alliance). They can also leave an alliance.
Effects of Alliances
The primary effect of an alliance happens only upon a declaration of war by or against any of its members.
Alliance Calls
When a DoW occurs involving a member of an alliance, that country will be presented with the option to call its allies for help. (This is referred to as an "alliance call" or "calling allies".) European AIs don't call allies for wars against pagans. If an AI is going to call allies, it will do so immediately. Human players can delay their alliance call for over 2 months.
When a country calls its alliance, all members must choose whether to honor the alliance and join the war, or dishonor the alliance. Again, AIs always do so immediately, whereas humans have up to 2 months to decide.
A country which honors the alliance call joins the ally's war coalition in the particular war that the call related to. If a member refuses, then it has dishonored the alliance: it immediately leaves the alliance. If it was the alliance leader, that role devolves to some other member of the alliance. All remaining members of the alliance receive a 1 year casus belli against a member which dishonors an alliance call.
When an alliance leader dishonors an alliance, the country that first entered the alliance will be the new leader. That leader is listed first in the save game in the alliances part of the save. In the game you can get this information by looking at the order of the countries that are listed in the alliance for the alliance leader. For example if Spain leads an alliance with Aragon and Navarre; for Spain the game might say "Alliance with Aragon and Navarre" in which case Aragon becomes alliance leader if Spain dishonors. But if the game says "Alliance with Navarre and Aragon" then Navarre would be leader.
Other Effects of Alliance
There are a few minor effects of alliances. A country can only diplovassalize and diploannex members of its alliance (in addition to some other conditions). A country cannot declare war on any member of its alliance.
Duration of Alliances
Once formed, an alliance lasts for 10 years. However, the starting date for the 10 years will be set to the current date any time any member of the alliance is at war.
In the game, you can see the expiration date for any alliance by selecting the diplomacy screen for a country that is a member, then mousing over the little "alliance" icon (two swords crossed, if you look closely). The tooltip shows when it will expire.