We are used to doing gravity problems with Newton's law of universal gravitation, F = -GMm/r^2, for things like planets and stars and point masses. But we also can show that the shapes of objects matters for how gravity behaves, such as the difference between spheres (1/r^2), long cylinders (1/r) and large flat objects (uniform gravity). This comes from Gauss's law for gravity.
However, once the shapes become even more different, such as rings and sticks with actual ends, Gauss's law does not work and we need to figure out how gravity behaves then. This is when we need to break an object into point masses, use Newton's law of gravity for each small mass, and then add up all the results to get the total...this is what integrals do for us! Check this out, with the focus being how to set up the integrals. We are not so focused on the final results, but rather the thought process and setup.