Suppose the P(XP,YP,ZP) is a point in the plane and N(XN,YN,ZN) is the normal, the equation will be:
Now, if we solve for D after substituting P coordinates in the equation we get:
Where the dot (.) is the dot product operator for vectors.
As for generating shadows, I didn’t try it yet, but, to generate the shadow of an object you project it on the plane of the ground before you project it on the plane of the screen. That involves calculating a projection matrix that will be multiplied with the model view matrix befor rendering the object. Search this site for how to use stencil buffers. There are some slides that illustrate this technique and other techniques like generating reflections.