The main rule is that you will be competing against other Neighborhoods of the same size, that way everybody will have the chance to do the same amount of tasks.
In each Derby there will be a maximum of 15 Neighborhoods competing against each other, and after a new Derby starts, you will be again randomly paired up with other Neighborhoods of the same size and from the same league.
If you join a Neighborhood or opted in while a Derby is taking place, you will have to wait until the next Derby starts, that way Neighborhoods can’t gain an unfair advantage over the others by having extra participants and being able to do more tasks.
If you want to know more about who you are competing against with, you can go to the other neighbourhoods main screen. There, you will be able to see who is actually participating in that week’s derby.