First, know the brand/model you're shopping for so you can read about known issues.
For example, in some Toyota and Honda engine/transmission combinations there are known transmission cooler failures that had recalls or known failure modes. Verifying that had been addressed is important.
Otherwise I just don't buy anything other than Honda or Toyota, and maybe Mazda. The difference in reliability and ease of maintenance from those 3 to all the rest is dramatic. And if you drive one, you'll know immediately if it's alright.
It's worth spending more at purchase for these to minimize down time due to maintenance. Our Hondas just go, every time. We have some from the early 90's in my family - they ain't pretty, but they just work.