PACS 31.15. Ew, 31.15.Fx, 71.15.Mb, 79.60.Jv We review our methods to calculate optical response of molecules in the linear response time-dependent density-functional theory. Three distinct formalisms which are implemented in the three-dimensional grid representation are explained in detail. They are the real-time method solving the time-dependent KohnSham equation in the time domain, the modified Sternheimer method which calculates the response to an external field of fixed frequency, and the matrix eigenvalue approach. We also illustrate treatments of the scattering boundary condition, needed to accurately describe photoionization processes. Finally, we show how the real-time formalism for molecules can be used to determine the response of infinite periodic systems.