There are only two things you need to know about gears playing up – how to fix the rear derailleur and how to fix the front derailleur.
Maybe you bent the rear derailleur hanger when packing the bike for travel; maybe the baggage handlers were less than gentle; maybe a cable moved. The reason is unimportant during a race, but you need to fix this because your gears keep hopping between cogs robbing you of power and making a horrible noise. Here’s how to fix the rear derailleur and how to fix the front derailleur.
The rear derailleur
There are about five different reasons that your rear mech can play up. In a race, all you need to do is unscrew the barrel adjuster on the rear mech until it holds a cog in the middle of the cassette. Hop off your bike (get off the road so you don’t get cleaned up by another competitor). Unscrew the barrel adjuster (anti-clockwise) a few times and turn the cranks. Keep doing this until the gears go silent and the chain is holding a gear cleanly in the middle of the cassette.
You may have to screw the barrel adjuster back in a few times if you go too far. The point of the exercise is that you unscrew the adjuster until the gears are quiet and the chain is holding the cog cleanly with no skipping. You may find that the gears still play up at the extreme ends of the cassette, but as long as you can get most of your gears in the middle of the cassette, you will be able to finish the bike leg with minimal disruption.
The front derailleur
If your front mech stops working, you should ignore it. Simple. You can race just fine on either your big or little chainring. It might not be ideal, but your bike will continue to work. Front mechs are complicated beasts and if you’re not good at tuning them, don’t bother trying to acquire this skill in the middle of the race. Life is full of challenges and you should just accept this as a gift (or chuck a massive tantrum, either way…) and get on with your race. Pick the cog that works (big or little) and leave the chain on that cog for the rest of the ride.