We present the three-layer model to calculate the surface second-harmonic generation (SSHG) yield. This model considers that the surface is represented by three regions or layers. The first layer is the vacuum region with a dielectric function ${\ensuremath{\epsilon}}_{v}(\ensuremath{\omega})=1$ from where the fundamental electric field impinges on the material. The second layer is a thin layer $(\ensuremath{\ell})$ of thickness $d$ characterized by a dielectric function ${\ensuremath{\epsilon}}_{\ensuremath{\ell}}(\ensuremath{\omega})$, and it is in this layer where the SSHG takes place. The third layer is the bulk region denoted by $b$ and characterized by ${\ensuremath{\epsilon}}_{b}(\ensuremath{\omega})$. Both the vacuum and bulk layers are semi-infinite. The model includes the multiple reflections of both the fundamental and the second-harmonic (SH) fields that take place at the thin layer $\ensuremath{\ell}$. We obtain explicit expressions for the SSHG yield for the commonly used $s$ and $p$ polarizations of the incoming $1\ensuremath{\omega}$ and outgoing $2\ensuremath{\omega}$ electric fields, where no assumptions for the symmetry of the surface are made. These symmetry assumptions ultimately determine which components of the surface nonlinear second-order susceptibility tensor $\mathbf{\ensuremath{\chi}}(\ensuremath{-}2\ensuremath{\omega};\ensuremath{\omega},\ensuremath{\omega})$ are different from zero, and thus contribute to the SSHG yield. Then, we particularize the results for the most commonly investigated surfaces, the (001), (110), and (111) crystallographic faces, taking their symmetries into account. We use the three-layer model and compare it against the experimental results of a Si(111)$(1\ifmmode\times\else\texttimes\fi{}1)$:H surface, as a test case, and use it to predict the SSHG yield of a Si(001)$(2\ifmmode\times\else\texttimes\fi{}1)$ surface.