What factors contribute to a country joining a side in a religious league?

For princes in the empire, they decide based on their religion. For non-HRE nations, they join the side that opposes their rival.

This usually leads to a chain of large nations joining: Austria is usually the Emperor, so Austria's rivals joins the Protestant league. Then the rivals of those rivals join the Catholic league and so on.