Theory of the sticking coefficient for atom-surface scattering