How do I decide how to buy a bicycle?

It depends on your interests, goals and level of fitness. You could get a road bike or a mountain bike. Once you are clear about your bicycling goal you can start researching about brands and bike features. Perhaps you might want to look first at "Bicycling" magazine so you can learn about all the different gear and features available so you can decide what features are important to you and also depending on your budget you make a decision about what bicycle you can afford.