There are a variety of techniques for brushing your teeth, but one of the most popular ones is described here:
Hold the brush at a 45 degree angle toward the teeth and gums. Gently press against the gums so the tips of the bristles go in between the gum and the teeth. Then apply a few lateral strokes and roll down the brush to sweep the plaque away from the teeth and the gum. Repeat this motion 6 to 10 times and move on to the next area of 2 to 3 teeth. If your mouth is full of foam, spit out and continue brushing. Your brushing is completed when you have brushed all the surfaces of your teeth, not when your mouth is full! On chewing surfaces, short strokes work best to get the plaque out of the grooves and pits. When brushing the back side of your front teeth, hold your brush vertically to be able to reach the teeth better.
As far as frequency of brushing is concerned, ideally you want to brush your teeth after each meal. But if you can’t, brush at least twice a day- after breakfast and before going to bed.