For Tesla, collecting self-driving training data as well as general fleet data. For Square, collecting transaction data to mitigate risk so that merchants worldwide can take payments. For Uber/Lyft predicting areas where there will be people needing rides to optimize transportation needs.
Plenty of real-world applications other than ads.