The physics
A force far from the pivot turns a body more. Its turning effect is its torque: force × distance from the pivot.
τ = F × d balance: m₁ g d₁ = m₂ g d₂
A body at rest does not move and does not turn. So the forces add to zero. The torques about any point add to zero too.
ΣF = 0 Στ = 0
A uniform plank or rule has its weight at its middle. A body balances on a support right under its centre of mass.
x = (M x₁ + m x₂) / (M + m)
On two supports, take torques about one of them. Its push has no arm there. Just before a plank tips, the other support pushes with zero.
A balance with unequal arms gives two readings, one from each pan. The true mass is the square root of their product.
m = √(m₁ m₂)