We develop a simple theory for the effective dielectric function of a system of identical spheres embedded in a homogeneous matrix within the dipolar long-wavelength approximation. We obtain a relationship analogous to the Clausius-Mossotti relation but with a renormalized polarizability for the spheres instead of the bare polarizability. This renormalized polarizability depends on the bare polarizability, the volume fraction and a functional of the two-particle correlation function of the spheres, and obeys a second order algebraic equation. We calculate the optical properties of metallic spheres within an insulating matrix and compare our results with previous theories and with experiment. We obtain a closed analytical form of the spectral function and check that it obeys Bergman's sum rules [1]. We construct a 2D version of the theory and calculate the optical properties of a disordered array of spheres located on top of a semi-infinite homogeneous substrate. Results are presented and the role of the image dipoles is analyzed.