Motorcycles stop faster and accelerate harder when they’re straight up and down, because that’s when the tires put the most footprint to the road surface. Suspension components also work best in the pure vertical plane—leaning the bike over puts side loads on them, encouraging binding and frame flex.
Hanging off on the inside of the turn reduces the amount we need to lean a bike for a given speed and turn radius. In each illustration, you can see three red circles: one represents the center of gravity (CG) for the bike, one for the rider, and the third the combination of the two. There’s little you can do about your bike’s CG, but by hanging off you can move your CG (and thus the combined CG) lower and farther into the turn, and that means the bike won’t have to lean over as much. In return, you’ll have a greater tire footprint and better suspension compliance.
If you hang off far enough to actually touch your knee to the ground, you can also use your leg as stabilizing support to help hold the bike up in the turn. Naturally, this is an advanced technique only for racers, but even everyday riders can benefit from hanging off in turns, especially in the rain or on poor pavement.