Always pay attention to signs, be patient and choosey. Buy from a reputatable place, not some scrapyard scumhole shack.
First, find a car model(s) you're interested in. Shop all around state or nearby via internet, and look for the best deal of all. You must be patient; It might take weeks, months if you have that kind of time to wait but then again buying a car is a serious deal and takes that kind of time. Being hasty will cost you in the long run.
Classically, I'd always say get a Carfax vehicle report, but some problems go unreported, so you can't depend on their accuracy. This all leads into my friend's nightmarish episode when he purchased a 1999 VW Passat last Spring and he soon discovered it was laden with problems. Since I was living at his house at the time, I watched the whole unbelievable show go down: he sunk thousands into a car he originally paid $6,000 for because he had to have it. It cost him bigtime.
When I say listen to the signs: he was refused a loan by two banks (though his and his future wife's credit was excellent). The dealer he purchased it from was a buffoon who lied on various accounts, misled him about the car's problems (reported no major problems with the car at sale). Turns out it had a leaking anti-freeze pump, computer/HUD light problems that still haven't been resolved. He was hasty; bought the car within a week of finding the model he wanted.
Finally, weeks after he was originally going to pick it up, the guy never registered it with the DMV even though he told him he did over the phone (which is literally 20 seconds away). There were even more problems with it I cannot remember but he literally reported a new issue with the car each week. Hold the dealership accountable if they aren't honest, my buddy almost did but in the end he did not.
It was a real nightmare. Today, the car runs fine (still has electrical problems), but he's sunk so much in repair and grief into it over the last year defeated the deal he originally got.