Spotify wants to sell stock to investors — but first it will need to convince them it's worth buying in to the complex process of selling music.

The company, which filed its plans to go public on Wednesday, said it has paid more than $9.7 billion in royalties to artists, music labels and publishers since it launched in 2006. It had 71 million paying subscribers and 159 million monthly active listeners as of December, making it the largest streaming music service across the world by far.

In general, Spotify gets two classes of licenses for the music it distributes: Sound Recording License agreements, which cover the rights to a particular recording, and Musical Composition License Agreements, which cover the people who own the rights to the song.

Recording licenses. For the rights to the actual recordings, Spotify has deals with the big three record labels -- Universal Music Group, Sony Music Entertainment Group and Warner Music Group. Sony Music also owns more than 5 percent of the company.

Spotify also has a deal with Music and Entertainment Rights Licensing Independent Network (Merlin) for digital recordings from independent labels. However, it has recently run into some problems with music publishing companies, including a $1.6 billion lawsuit from Wixen Music Publishing that claimed it was using thousands of its songs illegally. Wixen's songs include "Free Fallin'" by Tom Petty, "Light My Fire" by the Doors, and selected tracks by Stevie Nicks.

Composition licenses. Within this category, there are two main types of licenses Spotify has to secure: performance rights and mechanical royalties.

Performance rights are generally paid to song publishers, and managed through two main firms in the U.S. -- BMI and ASCAP. A public performance license is needed when a song is performed in public -- including when it's streamed, as well as when it's played on the radio or on TV.

Mechanical royalties are generally paid to songwriters when a song is reproduced, whether that's physically on a CD or streamed. (The term is a holdover from when most music was physically pressed into a recording, like a CD or LP record.)

Mechanical rights for streaming services are governed in the U.S. by a government agency known as the Copyright Royalty Board. The organization ruled in January to increase rates by 43.8 percent over the next five years. The rates are based on a percentage of the streaming company's revenue or total content costs, agreed upon payment amounts by all parties.

There are other types of licenses and sub-licenses as well, and the groups responsible for collecting and distributing them differ between countries and regions of the world.

If this sounds confusing, that's because it is.

Take, for example, the song "I Will Always Love You" from the 1992 soundtrack for "The Bodyguard." That version of the song was performed by Whitney Houston, the recording of which is owned Sony Music Entertainment division Arista Records. However the song was written by Dolly Parton, who owns the composition, including the lyrics and melody.

Spotify would have to pay Sony to license the recording, who would then give Houston's estate a percentage of the stream. It would also have to pay the music publisher and songwriter. In this case, Parton is both.