Founded in 1999, Shazam was a rarity in music tech: a profitable company. It generates the bulk of its revenue through advertising.
Shazam shows ads to users while they scan their environment to identify a song or other audio playing nearby. The app also shows smaller display ads on the page where the identity of the song is revealed. (And even when Shazam fails to identify a bit of audio, usually due to inadequate time or quality of sound, it shows users an ad.)
Shazam also gets paid to refer traffic to Apple, Spotify and other digital music providers. The idea is that a user identifies a song, then is encouraged to go stream it on Spotify or Apple Music or download it from the iTunes store.
Apple has been talking up its services business to Wall Street, and it wants to be seen as more than a maker of beautiful electronics. So it makes sense for the juggernaut to invest in a software brand that already has recurring revenue and loyal users in dozens of countries.