You first do “bracketing”. That’s a fancy way of saying you take multiple shots and with each shot you adjust an attribute such as your focus point very slightly. You then merge or “stack” the images to get the focus parts of each photo to show up in a single photo. A lot of the newer cameras can do this automatically in the camera using menu settings but you can also do it manually yourself. You can also do it and change something like your white balance for each shot.I've never understood how stacking works. I've only seen it mentioned in astrophotography where they might stack hundreds. I think to get darker backgrounds and more clear stars.
The ultimate result if you do it correctly is a higher dynamic range (broader color spectrum) and greater depth of field than a single shot can do by itself.