You want the mouth/opening of the bottle to be as close as possible to the sidewall of the glass (without spilling the beer). This minimizes splashback. More on this later.
The goal here is to try and pour the beer down the side of the glass -- it is the chaotic splashing against the bottom of the glass that causes beer to foam excessively (read: excessive head). By tipping the glass slowly while you pour, such that it becomes more parallel to the ground, you can minimize this splashing.
When your beer bottle is approximately 75-85% empty, tip your glass completely upright so that it is perpendicular to the floor. This will apply an appropriate amount of delicious, frothy goodness atop your favorite brew.