Basically, Cerbearus is exactly right with his description. As for how it works, I'll try to put it into a little more plain English.
A person's Match Making Rating is basically what skill-level the computer THINKS you play at. It has a lot to do with who you play with, your win/loss ratio, and many other factors. It's honestly just long math equations that tells the computer what level of players to put you with.
How does this factor into each game? A good example is the fact that in many games, you will have players with a higher ranking and a lower ranking than you. If a majority of the players in the game are a lower ranking than you-sorry to say but that means that your mmr is lower than it should be for your current ranking, and that you will lose more per loss than you will gain per win. Vice-versa, if you're being placed with players much better, then the games thinks you're competent enough and should rise to a higher rank.
In both cases, the MMR acts to balance a player's level of skill when playing league, and the player's literal ranking.