What a rating actually measures
A FIDE rating is a running estimate of playing strength, built from results against other rated players. It isn't a score for a single tournament — it's a number that moves after every rated game, based on whether your result was better or worse than the rating difference between you and your opponent predicted.
The basic idea behind the maths
Before a game, the rating gap between two players implies an expected result — a big favourite is expected to score close to a full point, an even match is expected to split close to 50/50. After the game, your rating moves toward the actual result: beating a much higher-rated opponent gains you more points than beating someone rated far below you, because the win was less expected.
Why beating a stronger player is worth more
This is the part that confuses newer players: a win is not worth a fixed number of points. Upsetting a strong opponent moves your rating more than beating someone rated well below you, and losing to a much weaker opponent costs more than losing to a strong one. Over many games, this pulls every player's rating toward a number that reflects their real results.
Rating categories and floors
FIDE publishes separate ratings for Standard, Rapid and Blitz time controls, and a player's first official rating is usually set after a minimum number of rated games against already-rated opposition. Titled players and very active competitors will also see their rating update faster than someone who plays only a few rated games a year.