One quick way to achieve this using Blender Internal is to select the plane and add a new material, in the material settings under shadow, enable Shadows Only.

Next, you can optionally enable transparency, use Z Transparency and use the alpha slider to control the strength/darkness of the shadow.

To further enhance this and add to the realism, you can enable Ambient Occlusion and use a blend sky (for simple renders). It is also worth noting that the shadow you get is dependent on the type of lamp and world settings you use in some cases, in the image below I am using a sun lamp with ray shadow enabled and I also have Environment lighting turned on, this softens the shadow and its harder to control but gives a nicer subtle effect.

Here I am using a sun lamp and a point lamp with Environment lighting off, with this setup, I can easier adjust the opacity of the shadow with the transparency setting.

Finally, in a case like you describe above, just render the scene without the sky (untick sky under the scene tab), align the camera as best as you can to the angle of the background, render and use an Alpha Over node to join the render and the background together. Here is a quick example I did in a few minutes.

With HDR lighting and some tweaking, this can look really good. It's a bit tricky depending on how you want to use it and at times it will take a good amount of tweaking to get it to look 'right' but this is a sure way to go about it, the ground plane still catches the shadow but it is invisible.