In basic the ranking works so that the further apart two players are the more points can be won. Beating players ranked high above you will gain you more points than beating someone below yourself.
The max you can win/loose in one game is 30 points
If two players are on equal points then you can win/loose 15 points.
If player A plays Player B and beats him to win 20 points, then player B will loose 20 points. This means, the points won are taken from your opponent.
For a more detailed explanation to the elo rank please refer to the section below.
The ELO rating system as developed by Prof. Arpad Elo is simple, tested (by the international Chess Federation the FIDE) . The structure of the ELO system is mathematically very simple; it uses a table and a formula:

ELO
Difference

Expected
score

0

0.50

40

0.53

80

0.58

120

0.62

160

0.66

200

0.69

240

0.73

280

0.76

320

0.79

360

0.82

400

0.84

600

0.93

800

0.97

Based on the difference in ELO rating between two players. Basically, the table shows the Normal Probability Function which is used to estimate the player's strength distribution.

The formula to calculate a player's new rating based on his/her previous one is:

Rn = Ro + C * (S - Se) (1)
where:
Rn=new rating Ro=old rating S=score Se=expected score C=constant

Examples

Some examples of the ELO system are listed below. We will use constants for the player rankings

Player A = 1900

Player B = 2000

Player C =
2100

Example 1: C beats C

Example 2: C beats B

Example 3: A beats C

Ro =
2100 Se =
0.50 S =
1.00 Rn = 2100+30
* (.50) = 2100+15 = 2115

Ro =
2100 Se =
0.60 S =
1.00 Rn = 2100+30
* (.40) = 2100+12 = 2112

Ro =
1900 Se =
0.31 S =
1.00 Rn = 1900+30
* (.69) = 1900+21 =
1925