At the end of the session, multiply the number of players by the number of successful encounters. This is your base Experience Point award total for the session.
A successful encounter is one in which you challenge the players' characters. Taking opportunities that you can't possibly foresee doesn't necessarily count as an encounter. For example, spontaneously deciding to assassinate an important NPC isn't a successful encounter but escaping alive from any guards or militia protecting the NPC could count as one.
During a game session, keep a tally of all the times a player does something you enjoyed or does something inventive you didn't account for. At the end of the session add this tally to the formula.
In this way all characters increase in level at the same pace. The only way a character might go up in level slower than someone else playing in the same group is if they miss a session, or their character joined the group at a lower level.
A session with four players and three successful encounters that had two things you liked would be worth 14 XP for everyone playing, or (3 x 4) + 2 = 14.
Always be honest with your players about the XP Formula and how you are applying it. If an encounter would only be successful if the characters avoid combat, tell them before you even introduce the encounter otherwise they'll feel cheated in the aftermath.
When a character rests, if they have enough XP to reach the next level then they receive all the benefits of the new level.
Before 10th level, characters increase their Hit Dice each time they level up. The player rolls their new Hit Dice to determine their new Hit Point total. Their CON is applied for each level of the character. Thus, a 4th level wizard with a +1 CON who has just attained 5th level rolls 5d4+5 to determine their new Hit Point total. If the new total is less than the old, the character can add their CON once to their old HP total. This way a character’s Hit Points always rise when they go up in level.
After 9th level, Hit Dice doesn't increase and Hit Points don't always go up - but they still never go down. When the player rolls their Hit Dice they begin adding a bonus number of Hit Points to their final total. For example, 10th-level wizards receive +2 to their Hit Dice. The same wizard above would roll 9d4+11 (+9 for CON and +2 for 10th level).
When a character dies, the player can make a new character with half of the XP total of the previous character, round up.
The XP Formula is something I created to incentivize moving the plot forward. This is derived from the number of players because large groups sometimes don't allow every player to have equal time - I played a game with 7 other PCs for years and some weeks felt like I accomplished nothing because my character didn't have "screen time" - and on top of this, the formula also allows the GM to track how fast they're progressing their own game. With only 2 or 3 players, if you're not progressing through encounters fast enough than it allows you to self-correct and push the players to act more. Additionally, a GM might decide they've bloated their game with too many incidental encounters and now they can look at the formula and decide to cut the fat from their role-playing banquet.
Leveling up when resting comes directly from Dungeon World and rolling Hit Dice to determine your new Hit Point total is another mechanic from Stars Without Number.