Let us consider a uniform ring of radius a with centre at O . Let a point P is on the axis of the ring, at a distance r from the centre of the ring.
So the Gravitational Intensity at the point P due to the ring is,
\displaystyle{E=\frac{GMr}{(r^2+a^2)^{3/2}}} , where, M is the total mass of the ring, G is the gravitational constant. READ IN DETAIL.

Now we want to find the point on the axis where the gravitational force is maximum, i.e, \frac{dE}{\,dr}=0 .
\frac{d}{dr}\left[ \frac{GMr}{(r^2+a^2)^{3/2}} \right] =0or, \frac{ (r^2+a^2)^{3/2} -r\frac{3}{2} (r^2+a^2)^{1/2}2r}{ (r^2+a^2)^3 }=0
or, (r^2+a^2)-3r^2=0 \\or,\ a^2=2r^2
or, \displaystyle{r=\pm\frac{a}{\sqrt{2}}}
This the position on the axis on the ring, where the gravitational attraction is maximum.