It's been an issue since the advent of the automobile and still even cyclists cannot come to a consensus. Despite laws that define where we are supposed to ride, we still argue to ride on sidewalks, against traffic and for separate lanes. A very good source for information (in the USA) is the League of American Bicyclists at
http://www.bikeleague.org They recommend these five "Rules of the Road" for safe and responsible cyclists.
FOLLOW THE LAW
Your safety and image of bicyclists depend on you. You have the same rights and duties as drivers. Obey traffic signals and stop signs. Ride with traffic; use the rightmost lane headed in the direction you are going.
BE PREDICTABLE
Make your intentions clear to everyone on the road. Ride in a straight line and don’t swerve between parked cars. Signal turns, and check behind you well before turning or changing lanes.
BE CONSPICUOUS
Ride where people can see you and wear bright clothing. Use a front white light, red rear light and reflectors when visibility is poor. Make eye contact with others and don’t ride on sidewalks.
THINK AHEAD
Anticipate what drivers, pedestrians, and other people on bikes will do next. Watch for turning vehicles and ride outside the door zone of parked cars. Look out for debris, potholes, and other road hazards. Cross railroad tracks at right angles.
RIDE READY
Check that your tires have sufficient air, brakes are working, chain runs smoothly, and quick release levers are closed. Carry tools and supplies that are appropriate for your ride. Wear a helmet.
Again it's my $.02 worth but it has worked well for me in more the 40 years of on the road cycling.
Gizmo