Theory of the scanning tunnelling microscope