We review density functional theory (DFT) within the Kohn-Sham (KS) and the generalized KS (GKS) frameworks from a theoretical perspective for both time-independent and time-dependent problems. We focus on the use of range-separated hybrids within a GKS approach as a practical remedy for dealing with the deleterious long-range self-repulsion plaguing many approximate implementations of DFT. This technique enables DFT to be widely relevant in new realms such as charge transfer, radical cation dimers, and Rydberg excitations. Emphasis is put on a new concept of system-specific range-parameter tuning, which introduces predictive power in applications considered until recently too difficult for DFT.