For an object thrown with a speed v and at an angle T with respect to the horizontal the distance of its trajectory is given by the equation: D = [( v^2 *(sin 2T) / g].
If we want to make D the maximum for the same initial velocity, sin 2T should be made equal to 1. As sin 90 = 1, to do that 2T should be 90 degrees or T should be 45 degrees.
Therefore if we want to launch a missile to cover the greatest distance it should be launched at an angle equal to 45 degrees to the horizontal.
The path taken by by object projected in any upward direction other than the vertical, moves under the influence of two forces. These are the momentum of the object due to the velocity at the time of launch of the object, and the force of gravity. In this way the object takes a parabolic path moving upward as well as forward in horizontal direction. The horizontal velocity of the object, neglecting the air resistance remains constant, but due to the force of gravity the upward velocity gets reduced till the object reaches a maximum height, when the velocity becomes zero. Beyond this point the object continues to move forward in horizontal direction at uniform velocity but with increasing downward velocity. This continues till the object hit the ground.
The total horizontal distance covered by the object for a given velocity of launch depends on two things. The horizontal component of the velocity and the time for the object to hit the ground after launch. This horizontal component of velocity is maximum in the horizontal direction, and reduces as the angle of launch with respect to horizontal is increased. At 90 degrees the horizontal component of velocity reduces to zero. On the other hand the height to which the object will rise and the total time for which it will remain airborne is zero at horizontal angle of zero, and maximum at angle of 90 degrees.
The total horizontal distance travelled by the object is thus maximum at a point in between the two. This point occurs at an angle of launch of 45 degrees to the horizontal.