Let's number the flags 1 to 25.
And your can start removing from 25 to 1.
Specific answer: $N=25$.
Who removes flag 5 will remove flag 1 also no matter how many flags the other team removes. If team A removes flag 5, there are 4 left and the team B can leave 1, 2 or 3 flags. In each case team A can pick flag 1.
Who removes flag 9 will get to remove flat 5 also, hence flag 1 based on the same logic.
Going on this logic....
You have to remove flags, 5,9,13,17,21,25
So if team A starts, they should just remove 1 flag (#25) and follow the logic above and they will win for sure.
General for any $N$.
Always remove any flag numbered $4\times K+1$.
If there are N flags, team A wins if $N \neq 4 \times K$ and loses otherwise.
Let's say it's A's turn to pick.
There are 4 flags left, A is a loser for sure so A picks 3 and B wins.
There are 5 flags left, A picks 1 and makes B the sure loser (case above). If they pick 2 or 3, B wins, so A is a loser for sure. So A has to pick 3.
There are 6 left, A picks 1 and make B the loser for sure (case above), So B has to pick 3 and C wins, this makes A a sure loser. If A picks 2, same thing happens. B is sure loser, C wins. If A picks 3, B wins, so in any case A is the sure loser so they have to pick 3 and B wins.
There are 7 left. A picks 1, B has to pick 3 (case above) and C wins. Same goes for A picks 2. So A is again the sure loser So they have to pick 3. In this case C wins.
There are 8 left. A picks 1, B has to pick 3 (case above) and C has to pick 3 (from the 4 left) and A wins.
There are 9/10 left. A picks 2/3, B has to pick 3 (case above) and C has to pick 3 (from the 5 left) and A wins.
There are 11 left. A picks X and makes B the winner because of the 2 cases above. So A is the loser for sure, so they have to pick 3 and B wins.
There are 12 left. A picks 1 and makes puts B in the case above so C wins. For A picks 2 and 3 B wins (cases above). So A picks 3 and B wins.
Still trying to find a formula.
Below is the original answer before I know what happens with the losing team.
Case 1: Alliances (yeah, that's why you watch Survivor )
If alliances are formed and you are not in an alliance you are screwed for sure.
Let's say you are on team A and B & C form an alliance, A always loses.
in order to make sure A picks #1, A has to pick #4, but here are the possible cases:
If there are 6 left after your pick, B + C pick all of them (3+3).
If there are 7 left after your pick, B picks 1 + C picks 1 so there are 5 left and you don't get a chance to play next round because B + C can pick them up.
If there are 8 left after your pick, B+C pick 3 and you end up as above.
If there are 9 left after your pick, B+C pick 4 and you end up as above.
If there are 10 left after your pick, B+C pick 5 and you end up as above.
If there are 11 left after your pick, B+C pick 2 and you are left with 9. You can bring the total down to 6,7 or 8 and you are in one of the cases above. So you lose.
Case 2: No alliances (bhuuuu).
Assuming that a losing team will just pick at random when they are sure they will lose.
Who ever picks #5 is sure of losing because the second one after you will pick #1 no matter what the first after you picks.
If there are 6 flags left, you (team A) pick 1 and you have a 33% chance of winning (if B picks 1 because B will choose at random 1 2 or 3 because they know they are going to lose).
If there are 7 flags left, you (team A) pick 1 and you have a 67% chance of winning (B will be in the case above and will choose 1 because a 33% chance is better than none, and C will be the loser for sure).
If there are 8 flags left, you (team A) pick 2 on the same logic as above.
If there are 9 left, you pick 3 on the same logic as above.
If there are 10 left just pick at random because you are going to lose. What ever you choose, B will be in one of the cases above for 9,8 or 7 and they will pick to leave it at 6, C will pick 1 to leave it at 5 not to be the sure loser and you will lose.
Based on the same logic, you don't want to be left to pick when there are $5 \times K$ flags left because you are the loser for sure.
Who picks when there are $5 \times K$ left has a 0% chance of winning.
Who picks after the person above has 67% chance of winning.
The third team gets the rest of 33%.
So if A goes first with 25 flags, they lose for sure, B wins in 67% of the cases and C in 33%.
I hope I didn't miss anything in the logic.