Here's a pretty good explanation I found:
Leaning counteracts the centrifugal force trying to flop the motorcycle over on the side away from center of radius of the curve. Centrifugal force acts on the Center of Gravity trying to push it outward. Gravity acts on the CG trying to pull it down to the ground. Balance occurs when the centrifugal and gravitational forces are equal.
Hanging off changes the position of the CG. It moves more mass to the inside of the bike. Imagine that the bike is upright and balanced. Now hang some mass on the left side handlebar. The bike will fall to the left because the CG is not on the vertical centerline any more. Same thing.
Hanging off changes the position of the CG such that the bike is more upright going through the turn. This does two things. First, it keeps low hanging stuff (like pegs) further from the ground giving more usable lean angle. Second, it keeps the tires more upright reducing the amount of squirm in the contact patch, increasing traction a bit.
The angle of the front tire in relation to the axial centerline of the bike is what controls the radius of the curve. Lean angle balances the centrifugal force with the gravitational force. (Remember that force = mass X acceleration. Gravity is an acceleration, changing directions is an acceleration).