Having bought a used car that turned out to be an utter lemon, I have learnt a lot the hard way :(. If I had my time again...
Make sure that you read the service history carefully; ours had a full (or was it? still have my doubts
) service history but it turned out the car wasn't serviced at all in the previous 40,000 miles! They had basically run it to the ground.
Look underneath, if it's very rusty it's probably got very worn brakes, driveshafts, etc.
Look over the tyres and body and all the externals, be as critical as you can. And talk it down the whole time you're with the dealer. Ignore her/his patter.
Test every electrical bit you can on the test drive (lights, reverse lights, indicators, windows, radio, wipers, the lot). Bring a friend to tell you to say if the hazards etc. are working.
Insist on test driving it yourself, and test driving when the engine is cold, especially.
Pay the AA to check it over. Or a mechanic you trust. BEFORE you buy.
If you do have any trouble than read up carefully about your rights & talk to Trading Standards before negotiating with dealer to resolve the problems.
Research online, of course, about what to pay for that year/make/mileage/condition.