Ambient light is probably achieved by making a normal render pass, only including ambient lighting, before you do the light shadowing passes. Now that I think about it, multiple lights are likely handled this same way; perform a set of 2 passes per light, one for creating the depth map and one for filling the color buffer. Each lighting pass would add to the color in the color buffer.
I should note that the above is a mixture of things I have read and "filling in the blanks". I don't have any actual experience with shadow mapping yet, so I may find that it's not quite what I am expecting. A perfect example of this is with creating the depth map. I assumed that an actual depth buffer was used, which would be set as a texture for the camera rendering pass. However, it appears as though Direct3D9 does not let you access the depth buffer like that. Instead, you need to create a texture and set it as the render target, and output depth values rather than colors from the pixel shader.
These are some resources which I found while researching shadow mapping.
Cubic Shadow Mapping in Direct3D
[size="1"]Reposted from http://invisiblegdev.blogspot.com/