As mrbassiam said. Most of the stems we get are from Games, remix promos/contests, commercial releases, and people who steal them.

Here's how it works for games:
Game is created
Game developers need songs for players
Developers license with artist agents to get stems (either pre-made or they get the whole thing and mix it themselves)
Developers mix stems (if applicable)
Developers make tracks/dlc/whatever that has a midi for the notes, and then the audio behind it
Rippers take that content (it's obviously mixed down for the game, sadly)

Sometimes, inside people like to release some stuff, or get it for personal use, then end up getting it stolen from them.
I knew a guy who copied every file he mastered for a company to a flashdrive and sold that flashdrive for quite a bit of money.

The home origin of all these tracks is of course the record labels and the artist's agents. They have their mastering people make mixes for certain things, like remix competitions. If you need more clarification just ask, I'll be sure to answer as well as I can.