What Max Pain calculates
Pick an expiration. For each possible settlement price, add up what every open option would be worth at expiry: each call pays the amount the price is above its strike, each put pays the amount the price is below its strike, times open interest and 100 shares. Max Pain is the settlement price where that total is smallest.
Example: a tiny chain has 1,000 calls open at the $105 strike and 1,000 puts open at $95. At any settlement between $95 and $105, both expire worthless and the payout is zero. At $110, the calls pay $5 × 1,000 × 100 = $500,000. At $90, the puts pay the same. Max Pain is anywhere between $95 and $105, and real chains, with many strikes, usually narrow that to one level. In Orogex, Max Pain is calculated for each expiration on its own, over strikes within 30% of the current price.
Where the name misleads
Max Pain measures payouts at expiry. It does not count how many contracts expire worthless, and it cannot measure traders' actual profits or losses, which depend on the prices they paid and how they hedged.
A popular story says option sellers push price toward Max Pain. The published research on expiration days is about something narrower: prices clustering at strikes (Ni, Pearson & Poteshman, 2005), through a hedging mechanism that works strike by strike, via dealers' gamma (Avellaneda & Lipkin, 2003).
Using it well
Treat Max Pain as a description of where expiring payouts are smallest, alongside the price, the walls and the gamma regime. Put/call ratios help in the same way: the open-interest ratio reflects positions held, which change slowly, while the volume ratio reflects today's trading and can jump within a day.
Caveat: Max Pain and the walls are both built from open interest, so when they agree that is partly the same data counted twice. Agreement is weaker evidence than it looks.