While on your bike, you need to obey the rules of the road for your own safety as well as that of others. You should follow all traffic rules just as if you were in a car–so you need to stop at stop signs and red lights, and you need to yield to cars when appropriate. Keep in mind that some drivers may not be looking for cyclists and so disobeying a traffic rule could end very badly. Even if you are obeying the law, double check to make sure that the cars around you are yielding to you when they are supposed to. Make eye contact with drivers if possible and do not assume they will give you the right of way.
You should ride on the shoulder of the road when possible. If there is no shoulder, stay as far right as you can so drivers have more room to pass–but leave enough room for yourself so you can swerve to avoid any obstacles in the road. There will be times when you need to ride in the middle of a lane because it is safer. For example, if you are turning left, you will need to get into the left turn lane. Or, if the road you are on suddenly has a right turn lane, you may need to move over to continue going straight. You might also need to use a full lane if there is not enough room on a road for a car to pass you safely.
You should learn basic bike signals to alert others of your movements. Point to the right with your right arm to signal a right turn and to the left with your left arm to signal a left turn. To signal a stop, hold your left arm out with the elbow bent down and your palm facing behind you. Give adequate time when signalling to allow drivers or other cyclists to react.
If passing someone else, shout out, “Passing on your left!” If you are in a group, include the number with you. For example, “Three bikes on your left!” If in a group, ride single file rather than next to each other, so cars can safely pass you.
If you are riding your mountain bike on a trail, you first need to check that bikes are allowed on the trail. You should yield to hikers and to horses. If coming up to another group from behind, shout out that you will be passing on the left and tell the group how many are in your party, so they do not move back into the middle of the trail before everyone in your group has passed.
Check out The Urban Cycling Survival Guide by Yvonne Bambrick for tips on riding on the road and Cyclecraft by John Franklin for advice on riding with traffic and riding while carrying children or goods.