It's all about your body language. Car drivers will see you and judge in a micro-second whether you are a potential threat to their speed and road space and one of the techniques taught to advanced drivers is that of forcing other drivers to behave the way you want them to. For example when approaching a car parked on the opposite side, don't allow approaching drivers to force you to slow down or swerve to give them space. Aim at them and take up space towards the crown of the road to make sure they stop and allow you priority. The same applies for cyclists; if you pussy-foot around in the gutter drivers will take liberties and squeeze past you. If you maintain a constant steady pace in "primary" position, which is a couple of feet out from the kerb, look serious, don't wobble, don't have clothes flapping around, drivers will see you as serious and give you the space you need.
The same goes for passive safety; watch and anticipate other road users, read pedestrians' body language, watch cars in side streets for wheel movement, establish eye contact with drivers, never assume a driver has seen you especially if you are riding straight towards them and are presenting only a gently expanding target. Check over your shoulder and move out into the middle of the road so as to move across their field of vision, the movement will attract their eye. All of this comes with experience.