How does the ranking system work?

How does the ranking system work?