Each festival may have its own rules. You can check them by pressing the Festival rules button in the Festival menu. If there is no active festival, you will see the rules of the last festival.
There are two possible festival rules:
1. Competition between towns in a cohort
Townships compete with each other only within their current cohort. Depending on the place taken, the township can move a league up, down or stay in the same league.
2. Competition between all towns in the same league
All the townships that are in the same league compete with each other. Depending on the number of trophies the township earned relatively to other townships in the league, it can move a league up, down or stay in the same league.