The spectral-Galerkin approximation of nonlinear eigenvalue problems