Theory of scanning tunneling microscopy