How does background removal work here?
A segmentation model looks at the photo and decides, pixel by pixel, how much of it belongs to the main subject. That gives a soft mask: 255 for the subject, 0 for the background, and values in between along hair and soft edges. The mask is computed at the model’s own size (1,024 × 1,024 for Medium and High), snapped to the edges of your photo, cleaned of the old background’s colour along the edge and applied to the photo at full size, so fully opaque pixels keep their original values.