Researching a gym before you join is the best way to ensure you won't get ripped off after you pay. You need to visit, ask questions and try before you buy.
Visit the gym during the hours you plan on using it. You have to know how busy it is, what machines are used the most and if there's room for you. Ask questions about rates, amenities and hours. You should know what is included for the price you'll pay.
Figure out if there's a long term contract you have to sign. Sometimes gyms offer month to month memberships but give discounts for either signing up for an year or paying for the entire year up front. If you know you'll be going there, and knowing means 100% sure, paying for the entire year up front can save you a lot of money.
Group Exercise Classes
If you want to take group exercise classes, use the pool or need child care, ask if these are included. Also see if any of the other amenities are extra or included in the price (tanning bed, swimming pool, basketball/tennis court).
If everything checks out OK, ask if you can get a trial pass. The good gyms always give out trial passes that are valid for about a week. If they're good, they know you'll like it and you'll end up joining. If they ask you to pay, try negotiating with them. Tell them you're very interested in joining but want to go for a few days and make sure the gym is for you.
The Bottom Line
If you follow these steps, you're a lot less likely to wind up hating the gym you're at. Also check out the New Gym Questionnaire to make sure you're picking the best one for your needs.