There are two straightforward ways to look at this, depending on whether you prefer a theoretical approach or a practical one.
The theoretical approach
If you can estimate how big your subject will be, and how far away it will be, then there's a relatively simple formula which can be used, and it gives quite good results in a lot of common situations.
The basic equation is:
Here are a couple of examples. In each case let's assume I'm using my Canon 40D, which has an APS-C sensor measuring 22.2 x 14.8mm.
Let's suppose I want to photograph a giraffe, like this:
The big giraffe is about 4m tall, say, and I'd expect to be able to get within about 25m of it. The sensor dimension which matters here is the 22.2mm because I'm shooting the giraffe in portrait orientation - the height of the giraffe aligns with the long dimension of the sensor.
So the focal length I need is ..... 22.2 x ( 25 / 4 ) x 0.75 = 104mm.
Or suppose I want to photograph the moon, like this:
The moon is 3,474km in diameter and its average distance from us is about 380,000km. This time the sensor dimension which matters is 14.8mm because I want to fit the diameter of the moon into the short dimension of the sensor.
So the focal length I need is ..... 14.8 x ( 380,000 / 3,474 ) x 0.75 = 1,214mm.
The formula is a pretty good approximation if you're shooting distant objects with a telephoto lens. But don't try using it for close-ups or wide angles, because the approximation isn't reliable in those domains.
(By the way, the experts amongst you will have spotted that the factor of 0.75 in the equation is an arbitrary one to help give you a decent composition - you don't want your giraffe / moon to completely fill the frame, and this factor is there to give your subject bit of room to breathe in the frame.)
We find that even a "relatively simple formula" can faze some people. And not everybody knows what size their sensor is. So instead of doing all this maths, why not just take some pictures?
The other day we had an enquiry from a client who needed to shoot some people at an awards ceremony. She'd be a little way from the stage - probably about 10 metres, give or take - but she wasn't quite sure how far. And she wanted to know what sort of range of composition she would have available to her with a 70-200mm or 70-300mm lens.
Fortunately the LensesForHire office is quite long, and our colleague Richie would rather stand around mugging for the camera than doing real work, so I did some experiments. I put a 70-300mm L lens on an APS-C Canon (a 350D as it turned out), I shot using all the focal lengths which are marked on the lens (70, 100, 135, 200 and 300mm), and I shot from ranges of approximately 15m, 10m and 5m.
Here are the results. If you're going to be in a situation where you have to photograph people, you might what to take this along as a handy cut-out-and-keep guide illustrating what effects you'll get with different lenses.