It is just a simple division of (Total Supply Bitcoins) / (your BTC). For instance, if you have 1 BTC you are among (21Mi / 1) the 21 million people with more BTC in the world... It is impossible 22 million people with more BTC than you, because there would be only 20 million BTC available... If you have 2 BTC (21Mi / 2), you are among 10.5 million people in the world with more BTC... The "top" part is just dividing the result by total world population (8Bi)