Firstly, ask the instructor. She will have good ideas. I am going to assume you are in good physical fitness with no underlying health conditions and not pregnant.
My experience with spinning classes is that maintaining effort, particularly during the HIIT parts is harder work than regular endurance cycling. I have collapsed in a couple of spinning sessions. Here are my tips:
If you are going regularly, start the session by warming up, and then gradually increase the gears on the spinning bike until you are the maximum you can sustain for beyond a minute without becoming distressed. For me, this is about gear 18 out of 24. Don't push it at this stage, just find a comfortable limit. Then drop down at least three gears, to find a 'base' gear, which you will use for flats/sprints. Moderate the gear according to cadence - if you are going around 80-100, stick in the lower gear. If you drop below this, raise the gear, and if you are out of the saddle, go for the max gear as found earlier.
Don't go mad when you sprint. Anything above 100 is OK, I aim for 120-140, but only for short bursts (30-40 seconds).
After each section of the workout, drop the gear down to your sprint gear (or a few below), drink water, and bring your heart rate down. I train with a heart rate meter on and try to watch my recovery times. I rarely get into zone 5, mostly on HIIT, and generally recover very quickly to zone 3 or 4.
Don't be tempted to push beyond the 'max' climbing gear until toward the end of the workout (e.g. last 10 minutes), then you can maybe increase the gear, but monitor your response.
Have a proper cool-down 'lap' on the bike for 3-5 minutes.
Don't try to cram in the same effort as an endurance ride into your 45-60 min spinning class. It won't work and you will feel rubbish.
Track your preferred gear, and slowly increase the base and maximum gears over time as you become more comfortable.