We propose a variational model to describe the optimal distributions of residents and services in an urban area. The functional to be minimized involves an overall transportation cost taking into account congestion effects and two aditional terms which penalize concentration of residents and dispersion of services. We study regularity properties of the minimizers and treat in details some examples.