Many methods. Suck it out with vacuum or a tube, Freeze the pipe (This is used if you don't want to turn off water to the building you're working on like large commercial facilities), use a jet sweat (inserts into the pipe and expands to prevent water from coming back when soldering on a fitting. Usually used with an open ended fitting so you can remove the jet sweat), Shove some white bread into the pipe to absorb the water (The bread will hopefully dissolve completely when reinstating water), and many more!