To avoid back pain, what's the right way to bend over?

Bend your knees when. Going down. Proper bending requires a fluid 'lumbopelvic rhythm'. This means the hips and spine should coordinate to be able to touch the ground. Ideally there should be a 2:1 ratio hip movement to spine movement.