Just recently I've had a couple of conversations about bikes that have been bought second hand, these were tales of woe about the things that have gone horribly wrong- usually on the journey home. Buying a bicycle second hand will (if done carefully) get you a bicycle which is cheaper, better quality and longer lasting than the temptingly cheap bikes seen in supermarkets and discount sports shops. I don't buy new bikes, partly because I like old bikes but also because i've rarely had enough money to buy a new bike of a good enough quality.
These are the things I'd check when buying a bike:
The very first thing I would do is check the bike overall, look at the frame and forks- is there any obvious damage, dents or rusty holes-does it look straight? If your instinct is that it all looks a bit wonky it probably is...
At the back of the bike i'd check that the wheel was attached, that it wasn't buckled beyond help, the tyre was inflated and not damaged or perished and all the spokes were present. I would check that the cables (gear and brake) were okay, the deraillieur moved and allowed the chain to pass through it. Finally I look to see that the brakes moved freely and that the brake pads still had sufficient rubber to stop the bike
In the middle I would check the saddle to made sure it was tight on the stem, that the stem was fixed into the frame (with the seat bolt). I would then check the front deraillieur and its cable to make sure that it moved properly, then check the crank to see that it didn't wobble, check the pedals to make sure they turn and aren't dangerously broken...at this point its probably worth checking the wear on the chainset
At the front I would check that the handlebars were attached to the bike and turned freely (no nasty grinding sounds), that brakes and gear levers were unbroken and working, that the cables were in a reasonable condition. I would check the brake pads etc for wear and for any damage to the rim including brake wear, dents, buckles and missing spokes...finally check that the wheel is properly attached and that the tyre is in a reasonable condition.
It sounds like alot to remember, but working from the back to the front of the bike it is logical and easy when you get started. If you try to do most of these things then you'll have a better chance of getting a reasonable bike- that said second hand bikes will invariably have some problems but as long as you know what they are-you can highlight them to the seller, hopefully get a reduced price and then figure out repair when you get home.
If you do decide to buy a new bike its probably still worth running through the list as unless you're buying from a reputable bike shop the putting together, checking and setting up of the bike can be a bit hit and miss. With cheap and second hand bikes, its not (in my opinion) worth buying something with suspension- on the road its not really necessary, it makes your bike heavy and has a tendency to seize.
If you fancy being a bit more thorough you can complete what's known as an 'M' check- you can have a look at my version below but i'm sure there are many others on the interweb- have a look at a few and pick one that works for you.