Under copyright law, a public performance of a musical work takes place whenever a composition is played in a public place. This includes usage as background music in pubs, restaurants, stores, on-hold system and phone messaging systems, as well as broadcast television, radio, film, web, and multimedia applications. The music may be broadcast on its own or as part of a production to which the music has been added. Permission to publicly perform a work must be obtained from either the composer (or agent acting on behalf of the composer such as Stockmusic.net), or from the performing rights organization that represents the interests of the composer such as ASCAP or BMI. The composer gets paid from their performing rights organization.
We have written a few articles that explain how this works in more detail.
https://stockmusic.net/blog/the-ultimate-guide-to-cue-sheets/
What Is Royalty Free Music: Breaking Things Down For Creatives