Theory of the refractive index of fluids