I'm trying to understand why one can write the electrical potential as follows \begin{equation} 4\pi\varepsilon_0\phi(\mathbf r) =\int d^3 r\,\dfrac{\rho(\mathbf r')}{\|\mathbf r - \mathbf r' \|} + \int d^2 r\,\dfrac{\sigma (\mathbf r')}{\|\mathbf r - \mathbf r' \|} \label{phi} \end{equation}
I know that the surface density charge can be written as $$\dfrac{\sigma}{\varepsilon_0} = \partial_n\phi_1-\partial_n\phi_2 $$ (Where $\partial_n = \nabla\cdot\mathbf n$ is directional derivative in the normal direction.)
But introduce two new potentials that I don't know how to deal with. Any clue about how to get the such expression for $\phi$?
EDIT: Or a better question: Under what kind of conditions can I write $\phi$ as it is written above?