Open your compositing software. I highly recommend using Digital Fusion or Combustion for this. However, Photoshop will also work. Again I will assume that you already have some knowledge about your compositing software so I'm not going to spell things out for you.
I'm going to show how these layers go together using Digital Fusion. I know that many of you are probably not familiar with the software, but the reason I'm choosing to do it this way is because of the software's node based workflow. I believe it will be easier for you to understand what is happening than if I showed a Photoshop layer and just said "here it is with this layer added, now here it is with that layer added." This way it will hopefully make more sense what I've done and will be easier for you to recreate on your own in other software's.
First off...Here is the completed "Flow" for visual reference. The flow is just a way of referring to the order in which your layers are put together. My flow runs from left to right. The first layer on the left is my lowest layer and as we go towards the right, other layers are put on top till we get to the final image which is saved with the "saver."

Plate_yard.jpg is the full res background photo were compositing our 3d objects into. The first layer we put on top of it is the Ambient light pass. The node labeled "Merge 1" is just like in Photoshop where you decide the blend mode for the layer on top, like if its going to be normal, multiplied, screened, overlaid, etc.
1. The first layer on top of the photo is the ambient light layer. If you saved out your files right, all you have to do is drop it on the layer above the photo and your ready to move on. You shouldn't have to create any masks or do any tweaks cause the alpha information should have taken care of all that for you. If your unhappy with the color of your ambient light you can use color correction on it at any point while compositing and you'll be able to see the results in real time.

2. The second layer we add is the key light layer. While looking at this layer I noticed that it was very dim. So I adjusted the brightness/contrast of it to make it lighter and adjusted the saturation. Look at the flow image above. You'll see that I loaded the image, then adjusted the brightness/contrast, then put it on top of the previous layers. I usually put all the layers together first before I start adjusting them because each layer will alter how previous layers look.

3. When the adjusted key light pass is placed on top of the ambient light pass we get this. If your using Photoshop set your blend mode to LINEAR DODGE.

4. When adding the ambient occlusion pass, you will probably want to adjust the levels so that your darkest areas aren't TOO dark. You can see in my flow that I've adjusted it a little with a color correction node (I altered the levels to make the dark areas lighter). This layer should be MULTIPLIED over the others.

5. When you do that you get the following result.

6. I've done some tricky stuff with the shadow pass. What I've done is instead of using the shadow pass directly, I'm instead using it as a mask. Let me explain. In the flow above you'll see a node labeled "Background 1." This is just a layer that is a solid color and I've made it the color I want my shadows to be. I've told it to use my shadow pass as a mask, so that the shadow color only shows up where the shadow pass says it can. This allows me to go back to my solid color "Background 1" layer and change the color of the shadows to whatever I want at any time. Its also a good idea to adjust the opacity of this layer so that your shadows don't go completely to your shadow color. That way you'll still be able to see the grass or concrete that is in shadow. You'll see what I mean when you try it.

7. Finally the specular layer is placed on top. If I wanted to I could do all kinds of things to it like add a bloom effect or change the specular color or intensity. If your using Photoshop you'll want to set the specular layers blend mode to SCREEN.

This image is now done and can be saved out.
Lets quickly look at the other photo I showed for compositing 3d objects into.

Because we're going to be on the steps, we need to model a rough version of them for the matte object so that shadows are correctly cast on the vertical parts of the steps.
Now to teach you about the ugly problem you may encounter with shadows. In the previous example we just happend to be at the right angle that the problem didn't show up. In the steps example we do encounter it, and that means we have to approach things differently.
The problem is the shadow map pass and objects that cast shadows onto themselves. The shadow pass is only creating a white area where a shadow is directly hitting an object. It does not consider backfacing polys that may in fact be in shadow. Here is the ugly problem we are faced with. Look closely at the spout of the teapots below. The underside should be in shadow but its not. Below is a render showing the problem and below that is the shadow pass that created it.
IMPORTANT...
You should render a normal shadow pass just like before just in case... You may need it to mask the specular highlights on your objects.


So we need a new approach. One solution is to not render a separate key and ambient light pass. Instead render them together. We will lose control of the shadow color on the teapots, but we can still control the shadows on the ground. On a simple scene like this its really not that big an issue if later on you decide you don't like the shadow color on the teapots and just re-render that pass. So lets combine the two passes into one. Here is how.
In place of your ambient and key light passes. Render out a version with both. Turn on both your ambient light and key light and render. Now your shadows for these objects are built into this layer. You should get something like this.

If you would like to create a shadow pass that is correct instead of combining these two layers it is possible. There are always other ways around things. You could make a material that would behave in such a way that would give you the layer you need so that you can still use the key and ambient light passes separately. If you want you can make a new material for these three objects. Make it white and put a falloff map set to shadow/light in the self illumination slot. Make sure the only light that's on is your key light and shadow casting is on. Save that image and then invert it in Photoshop. Use that as a mask to control a shadow color layer. Keep in mind that now you have 3 extra layers you have to render when you could get nearly the same results with just one.
Notice that the shadows on the teapots above are correct now. But we still need some kind of shadow pass for the ground. The solution is to render another shadow pass just as before, only this time select the teapots and sphere and go to their properties. Uncheck the box that says "visible to camera." If you render a shadow pass now you will only see the shadows on the ground. Because we made this alteration we need to change the order of our flow.

Below we see the shadow pass. It is now the first thing we put in the flow because our objects have to go on top of it.

Next is our new pass with both ambient and key lighting.

Now we add the ambient occlusion layer and the specular layer. I did run into the issue with the specular highlights that requires our old shadow pass to correct it. The specular highlight pass doesn't take into consideration your shadows. So you will get a bright highlight in areas that should be in shadow. To fix this we're going to pull out the old shadow pass we made sure to save and invert it. Now we will use it to mask the specular pass so that areas that are in shadow no longer are effected by specular highlights.

Alright...Now for some fancy stuff just because its fun. I've added a specular bloom effect. Blooming occurs on film because there is a light source that is too bright and the photo was taken with a longer exposure time which creates a soft glow when the film is processed. To create a specular bloom all you have to do is make a copy of your specular layer with the mask and blur it...Then adjust the brightness/contrast of it to make it brighter. You may have to blur it one more time, then put it on top of all your layers again. Don't go too overboard with this...Keep it subtle.
Digital Fusion has a "glow" node that will do this type of effect for you. You can see in my flow above that I used it, then tweaked it a little with some color correction before adding it back on top.

Finally we'll add a quick post depth of field effect. Often it is possible to do this without rendering a Z-depth layer (which I'm not going to get into in this tutorial). If your using Photoshop just make a copy of your final composite and blur it. Then add a mask that looks like the image below. In Digital Fusion you can blur the whole flow and add a spline mask which you then blur the edges of.

The final composite.

The talented folks over at Blur Studio have created two extremely helpful scripts that will save a compositing artist tons of time, and they are cool enough to have offered them free to everyone. One is called "The Onion" and the other is called "Render elements."
The onion is a more user friendly version of max's layer tools. Plus it has the ability to assign alternate materials and properties for your objects by just toggling a single button for each, once those other materials and properties have been set up of course. So if you wanted to swap your regular materials with an all white one for your ambient occlusion pass, you could just toggle a button on and off to switch back and forth between the different materials.
Render elements will allow you to save what I can best describe as a "state of max." Once you've set up everything you need to render your shadow pass, for instance, all you do is use the render elements script to save max's current settings. Continue doing this for all your different passes and then if you want to go back to a previous state, you can just load it back up with render elements. This script also works with the onion and will remember which layers were turned on or off and if they had any alternate materials or properties assigned.
You can get both of these scripts HERE. (Site currently down. I apologize for any inconvenience)
I hope that you've learned something by reading all this. Now go forth and produce beautiful images. I will not pretend to have all the answers, but if you have any questions about this tutorial or compositing in general send me an email and I'll do my best to help.