This chapter discusses the linear-response framework of time-dependent density-functional theory (TDDFT). It begins with a thorough and self-contained exposition of general linear-response theory for many-body systems. The time-dependent as well as the frequency-dependent response are discussed. Several exact representations and properties of the density-density response function are reviewed, such as the Lehmann representation and fluctuation-dissipation theorem, and the Kramers-Kronig relations. It is shown how several important spectroscopic observables are obtained from linear-response theory. Then, the TDDFT formulation of linear-response theory is derived. The key quantity in this formalism is the so-called exchange-correlation kernel. The remainder of the chapter demonstrates how this linear-response formalism can be used to calculate excitation energies in principle exactly with TDDFT. The Casida equation is derived, as well as several approximate schemes. A comparison is made with time-dependent Hartree-Fock theory.