Almost all the launch vehicles lift off vertically and are designed to reach orbital speed, altitude and orientation as the upper stage completes its injection burn.
Consider a launch vehicle lifting off vertically- The vehicle accelerates to overcome two forces- earth's gravity and the atmospheric drag.
Image from rocketmime.com
If the launch vehicle goes vertically up the whole way, it will reach the needed altitude, but will fall down as it won't enter into an orbit around the earth. However, if the vehicle is launched horizontally, the time spent in the atmosphere will make the fuel requirement prohibitive.
An ideal trajectory will reach the required position with minimum expenditure of fuel and minimum load on the rocket structure (which saves weight). This is usually achieved through the use of 'gravity turn' or zero-lift turn', which uses the gravity (which is perpendicular to the launch vehicle's longitudinal axis initially) to turn the velocity vector as it ascents toward orbit, instead of using the vehicles on-board propellant.
Basically, as soon as the vehicle clears the launch platform, a pitchover maneuver is executed (usually by gimbaling the rocket engines), directing some of the thrust to one side and creating a net torque on the vehicle.
Image from spaceflightsystems.grc.nasa.gov
Now, a small part of the gravitational force is directed perpendicular to the longitudinal axis. This is the beginning of the gravity turn. After the pitchover is complete, the engines are reset to point straight down the axis of the rocket again. From this point until orbit injection, the transverse gravity component continues to grow (as gravity is basically turning the rocket about its lateral axis) and causes the vehicle's velocity vector to rotate toward the horizon as it ascends (by turning the rocket nose towards ground).
"Gravity turn - phase 2" by AndrewBuck - Own work. Licensed under CC BY-SA 3.0 via Commons.
For a properly executed gravity turn, this gravity is the only force acting on the rocket that acts to turn the rocket, thus saving fuel (there may be some corrections due to wind, however, these are negligible). Also, the angle of attack is reduced to (near) zero, thus reducing transverse aerodynamic forces and enabling a lighter vehicle.
The exact initial pitchover angle depends on the specific launch vehicle, time of launch, orbital destination etc.
For Saturn V, this maneuver is initiated 000:00:13 seconds after launch, after the rocket has lifted off some 450 ft,
After clearing the tower, a tilt and roll maneuver is initiated to achieve the flight attitude and proper orientation for the selected flight azimuth. Launch azimuth is 90 degrees; flight azimuth may vary between 72 and 108 degrees, depending upon time and date of launch. From the end of the tilt maneuver to tilt-arrest, the vehicle flies a pitch program (biased for winds of the launch month) to provide a near zero-lift (gravity-tum) trajectory.
In the case of the space shuttle, the maneuver is initiated before the spacecraft experiences the maximum dynamic pressure (termed "max q").
The roll maneuver is performed shortly before max q is reached because this "heads-down" orientation helps alleviate the stresses that the dynamic pressure loads cause on the vehicle's structure.
The second factor we need to consider is that for each mission, the Shuttle must launch at a certain azimuth angle in order to be inserted into the correct orbital plane. Since the launch pad (and therefore the Shuttle) sits in a fixed position, the Shuttle must perform a roll maneuver during ascent in order to orient itself to achieve the desired launch azimuth angle.