We extend our exact analysis for plane wave scattering from a sinusoidal surface to include the case of an arbitrary periodic surface. Both Dirichlet (transverse electric polarization) and Neumann (transverse magnetic polarization) boundary conditions are considered. The method uses Green's theorem and our previous idea of expanding the surface fields in Fourier series multiplied by the Kirchhoff or physical optics approximation. The expansion coefficients solve a set of linear equations. The field amplitudes of the upgoing scattered (or evanescent) waves (valid above the highest surface excursion) are expressed as a summation over these expansion coefficients multiplied by integrals over the surface function. The Rayleigh hypothesis is not invoked. Some examples are presented. For an analytic surface, steepest descent methods yield the asymptotic values of the amplitudes. Using this and other asymptotic results, the convergence of the scattered wave expansion is studied as it is analytically continued into the surface wells, and a simple and explicit confirmation of the conditions under which the Rayleigh hypothesis is valid is presented as well as new results for other examples. The periodic surface examples include a sinusoid, an echelette, a quadratic surface, a log cosine surface, a vortexlike surface, a cycloid, a trapezoid, a full-wave rectified surface, and a surface of semicircular cylinders (bosses). The method is general and applies to a very broad class of physical problems.