The easiest and safest way to position a tall ladder against a wall is to push the base against the wall, walk the top of the ladder up until it's vertical, then pull out the base. The ladder's angle is critical to safety. If its base is too close to the wall, the ladder is generally unstable and likely to fall backwards when you climb it. If it's too far away, the ladder may bend or slide out from under you. The distance from base to wall should be equal to about one quarter of the ladder's length.
Be sure your ladder is on a firm surface. As you climb or reach, keep your weight centered. Do not lean out to one side; keep your hips between the rails; never stand on the top two rungs.
When using an extension ladder to reach the roof, extend at least two rungs above the eaves. This way, you can hold onto the ladder as you step onto the roof. Then, above all, be safe!