Like everything related to driving, it eventually becomes automatic.
It's not that you're consciously looking at each car and saying "Is this car going to be a problem? Is this one a problem?" Instead, you recognize patterns. If a car suddenly weaves out of its lane, it triggers a tinge of fear and you give that car a wide berth until you can pass him and leave him behind. If you see brake lights go on 10 cars ahead of you, you know that you're going to have to slow down, so get ready for it (oftentimes, I'll let up on the gas as soon as I see brake lights go on a quarter mile down the road, and by the time I get to the traffic, I'll be going their speed anyway). If you're in a car's blind spot, pay extra careful attention to turn signals or any deviation from his lane, and try to pull forward or behind so he can see you. If a car is clearly in a rush, it's a good bet he's going to weave in front of you, so hang back and make sure you have room to adjust if he does. If two cars try to enter the same spot in the same line (this is my personal biggest fear, they're both in each other's blind spot and each has reason to believe the lane they're switching into is clear), hang back, and honk if it's clear that they don't see each other.
It's about pattern recognition, knowing which situations are dangerous so you can be extra careful whenever it looks like one of those situations is happening.