Probing properties of complex materials using terahertz spectroscopy