Retarded dielectric theory of electron energy loss in multilayers and superlattices