Microscopic Theory of Terahertz Spectroscopy on Semiconductor Nanostructures