Based on four factors, you can recieve Trainer Points. When you get a certain number of points, you rank up. The Ranks mainly allow access to more money, the chance to challenge certain trainers, and special items (such as eyepieces, archballs, masterballs, and the such.)
The four factors of Trainers points are: Rare Pokemon, Pokemon Quantity, Battles Won, Evolved Pokemon.
You get a point for every evolved pokemon in your team, another for every rare pokemon, one for every 6 pokemon, and one for every 5 won battles.
For example, on the day this was posted, Devin had 3 trainer points for having two rare pokemon (Rotom and Gible), and one evolved pokemon (Kirlia).
The ranks are the following.
0-4 points = Novice.
5-20 = Beginner.
21-45 = Intermediate.
46-75 = Advanced.
76-100 = Elite.
101-200 = Champion
201 + = Master
When you get to Master Rank you can buy master balls.