Best ways to avoid getting hit by cars? When riding through city traffic, what are the best ways to increase the chance you are seen, given a bit of space, and are not touched by any vehicles?
As cyclists, we are vulnerable to any collision. A collision with a truck, bus, car, bicycle, pram, skateboard, rollerblader, pedestrian, dog, or even a domestic cat, will almost always cause a problem, if not an injury.

Vehicle drivers are just people like us, except that they are in a comfortable safe box, maybe with crying kids in the back, and a have just dropped an ice-cream on their lap. You cannot expect them to be looking out for you all the time.

So it's up to us to take 100% responsibility for our own safety. It doesn't help us if we were 100% in the right, but are 100% dead.

So ...


Choose where you ride. Avoid high speed and congested roads. Statistics show that the probability of a collision rises rapidly after the speed difference between two road users exceeds 20 kph (12 mph). So choose paths without vehicle traffic, or roads with lower speed traffic. See How does the risk of a cyclist colliding with a vehicle vary with the speed difference?
D'oh! I originally left out Ride where other people ride, or ride with a buddy. Drivers are much more likely to notice multiple riders. And when there is more than one of you it's not so easy to justify squeezing past. Finally, those drivers who might be tempted to drive dangerously close are intimidated by the you having a witness.
Avoid turns in the middle of congested intersections. If you feel in danger, then ride at the side of the road across the intersection, wait for the lights to change, then continue on the crossroad. In my town this is called a square turn, in other places it's called a hook turn.
Keep reasonably close to the curb, about half a meter (yard) to one meter out. You need to ride in a straight line so that the vehicle drivers can predict your path, so ride where the road surface is at least adequate. In light traffic, move toward the curb a little as the vehicle approaches and then resume your position after the vehicle passes. In heavier traffic, just maintain your path. Some cyclists like to have a mirror to know what's happening behind them.
Traffic behaviour can vary in different parts of the world, so take your local traffic conditions into consideration. In my town, the inner city traffic is congested but used to seeing cyclists. So if there is no bike lane, cyclists are generally able to mix with the traffic fairly safely when the bikes are moving faster than the cars.
Wear brightly colored clothing. In some parts of the world, black is fashionable. Avoid it. One advantage of a lot of so-called Lycra is that most of it is brightly colored. Some people wear hi-visibility industrial safety tops.
Always ride with lights turned on. If legal, then set them to flash mode. Choose lights that flash more than once per second. Slow flashing lights can be missed as drivers shift their attention quickly. Some places (Germany?) forbid flashing bike lights.
And stay alert. Listen for traffic. Don't rely on them seeing you.
In some situations, you need to take a whole lane, so that the drivers behind don't drive too close by trying to squeeze past when there is not enough room. You should only do this when the traffic is moving at a similar speed to you.
And as mentioned by mjsqu in comments, keep away from parked cars to avoid doors.