Why does the focal length of a telescope have an effect on the magnification? I previously asked that 


  Is the angular resolution of a telescope irrespective of used eye-piece?


I learned that the resolution is fixed when the light enters the telescope, and that the eye-piece is used just for magnifying the obtained image at the focal plane.

Now, the magnification of a telescope is calculated as 

$$
\text{magnification} = \frac{\text{focal length of telescope}}{\text{focal length of eye-piece}} \qquad (1)
$$

For example, if the focal length of my telescope is $900$ mm and I am using a $25$ mm eye-piece, the magnification I get is 

$$
\text{magnification} = \frac{900\ \text{mm}}{25\ \text{mm}} = 36.
$$

However, where does the formula $(1)$ come from? Why is the magnification affected by the focal length of the telescope and eye piece?

(I am using a Newtonian telescope if it matters.)
The objective lens of a telescope forms an real image of the night sky, the size of that image is in proportion to the focal length of the objective lens. The reason for this is simple geometry: If two stars are 1 arcminute apart, and the lens is forming an image of them, then the further the image is from the lens, the further apart the images of the two stars will be.

The eyepiece then magnifies the image. When using a lens to magnify you put the object at (or near) the focal distance from the lens. The shorter the focal length of the eyepiece, the closer you can get to the object and so the larger it appears. All this is a round about way of saying the the magnification of a lens is inversely proportional to the focal length. 

In the case of a telescope, the "object" being magnified is the image formed by the objective lens. Putting this together: the apparent size of the image is directly proportional to the focal length of the objective lens, and inversely proportional to the focal length of the eyepiece, and the constant of proportionality is 1 (just imagine that both the objective and eyepiece have the same focal length). So 
$$\mathrm{Mag} = \frac{L_o}{L_e}.$$

This might be a useful point to mention that magnification is usually the least useful function of an astronomical telescope. Their main purpose is to gather light.