We calculate the transverse and the longitudinal infrared absorption spectra of the hydrated silicon surface using a first-principles approach. The absorption spectra are computed for two different configurations of water molecules dissociatively chemisorbed on the Si(100)-(2 X 1) surface at full coverage. Our calculations compare favorably with the experimental spectra for both the frequency and the intensity of the absorption peaks. Our results suggest the possibility of combining infrared spectroscopy and first-principles theoretical modeling to investigate the phase diagram of the Si(100): H2O surface and similar systems. We also provide a detailed discussion of the underlying formalism, already introduced by Giustino and Pasquarello [Phys. Rev. Lett. 95, 187402 (2005)]. The methods described here are of general validity and provide a basis for the theoretical modeling of infrared spectroscopy at surfaces and interfaces.