Cycling shoes can clip (attach) to the bicycle pedals. I think there's a 'cleat' on the shoe and a corresponding socket on the pedal. There are several types/shapes of shoe/cleat, which need to match the type of pedal. So part of the answer is, "buy the type of shoe which matches the type of pedal". A common type of shoe/pedal is called "SPD". One advantage of this type (compared with some other types) is that it's possible/easy to walk in them, because the cleat is recessed into the sole of the shoe (some other types of shoe with an exposed cleat are apparently not easy to walk on; for this reason SPD is recommended to e.g. 'commuters' or 'mountain bikers' who may want to walk a little in their shoes).
When you buy shoes for your own bike you can buy the corresponding pedals (e.g. SPD). For a spinning class you may want to find out what type of pedals they have already and get corresponding shoes (assuming you can't change their pedals).
When I was buying mine, I was in the shoe section at the front of the bike store looking at the shoes on display. I told the salesperson that I'd heard it's good to get a shoe with a stiff sole (which distributes the force over the whole of the bottom of the shoe), at which he went and fetched a pair/style from their store room which wasn't on display, a Shimano M087, and recommended it. The first one I tried that's theoretically my size seemed just a little tight. I'd rather have a shoe too big and tighten it than a shoe too small which I can't loosen, so I asked to try the same but the next size up: and I've been happy with that. There's room for my toes, and it's easy to adjust the tightness.
The cleats are adjustable but I think have no 'float'. I did actually develop knee pain within the first 3 weeks (cycling 2 1/2 hours per day), due to a combination of several factors that wouldn't necessarily apply to you, for which I adjusted my seat height and the position of the cleats in the sole (and other thingsand other things).
If you're going to use them on a road bike too, advice people gave me was:
- Practice away from traffic until you've fallen a few times (because everyone falls, until unclipping has become automatic / second nature)
- Practice in winter so that you're wearing a coat to fall on when you do fall
On my bike I chose pedals which clip on one side but not the other: so I can use them with ordinary shoes as well (not that I do) and I can ride with bike shoes but without clipping in (which I find very occasionally useful e.g. when the road surface is bad and I'd like to be able to put my foot down extra-easily in an emergency). I'm not strongly recommending a half-pedal of that sort, but they are available if you might find that useful.