Here's a basic run down of the system as I understand it;
It takes your stats, depending on Role(e.g. adc would be counted heavily by CS, support by assists), kills, deaths, assists, and compares them with the stats of the other people that have played that champion. It also compares the stats and stuff of your opponents, so if they intentionally fed for a while it'll be harder to get an S