Microlocal analysis and spectral theory