To do so safely and legally, you must follow the vehicle laws. Therefore:
1) You must ride on the right side of the road, moving in the same direction as the rest of the traffic.
2) You must stop for red lights and stop signs.
3) You must have lights and reflectors on your bike when traveling at night.
The law also asks you to ride near the right edge of the road. This is good, except
1) When turning left. Either turn left using the left-turn lane or continue through the intersection, walk across the street on the crosswalk, and then get back on the bike.
2) When there is a right turn lane, and you are going straight. Stay in the through lane, and watch for turning vehicles.
3) When there is not enough room for vehicles to pass you safely. Then it is OK to ride in the center of the lane.
Many bike riders in the US don't follow these rules, and the police don't stop them, but they have many accidents. The main causes of bicycling accidents for adults are (the most important first):
1) Riding at night without lights.
2) Failing to stop before entering the roadway or for stop signs and red lights.
3) Riding in the opposite direction from motor vehicles.
4) Riding on the sidewalks and crossing on crosswalks.
5) Getting clipped by a vehicle that squeezes by.