THz spectroscopy for fundamental science and applications