What actually happens when you let apps track your activity?

What kind of data is being collected by our devices, and how is it being used? Should we "Ask app not to track"?