Geometrical aspects of spectral theory