From what I understand, an alliance is automatically created in the following scenarios:
1. Player 1 threatens Player 3. Player 2 then also threatens Player 3 elsewhere so that no matter which front he defends he will suffer material loss (i.e. the total value of his pieces will decrease. The relative values are simple and I'll assume you already know them--they're on Wikipedia if you don't). Player 1 and Player 2 are now in an automatic alliance, because they forced material loss on Player 3, who was unable to defend himself on both fronts.
2. Player 1 moves so that one of Player 2's pieces is now threatening Player 3 with material loss. Player 1 has now just allowed Player 2 a positive gain. Previously, Player 3 was under no threat from Player 2's piece, however, a threat was created when Player 1 moved his piece out of the way. That action can be considered equivalent to an attack (but using another player's piece), hence the automatic alliance. So, to reiterate, Player 1 moves so that Player 2 is now threatening Player 3, though this was not the case before Player 1's move. Player 1 has just created a new threat for Player 3 by allowing Player 2 to obtain material gain.
Now, there is an exception. If Player 1 attacks Player 2, and Player 2 makes a defensive move that results in Player 1 threatening Player 3 with material loss (such as a check), Players 1 and 2 are not in an alliance, because Player 2 was defending himself from Player 1 and would have suffered a loss if he hadn't moved defensively.
Alternatively, if Player 1 attacks Player 2, and Player 2 responds by checking Player 1 (or threatening other material loss), after which Player 3 threatens another of Player 1's pieces, Players 2 and 3 are not in alliance because the initial check was a defensive move made to prevent material loss.
Hopefully that helps, but if not, I can clarify further.