Analytic study of self-gravitating polytropic spheres with light rings