Practice.
i'm a gay total bottom and i consider a Mans semen to be precious stuff, a part of Him. It's His seed and i'm a garden. The idea of not retaining His seed offends something in me. Honestly, the idea of a Man masturbating and not putting His seed in a person who wants/needs it, makes me sad... it feels so wasteful.
When a Man fucks and ejaculates inside of me, where it is planted depends on His length and also sort of how He fucks. i think there is a natural response of driving "balls deep" when a Man has an orgasm, this has the effect of planting His seed deep inside. But some Men fuck through and while having and orgasm, so His seed may get spread around the rectum a bit.
Re "length," depending on the Tops cock length and the bottom rectum length, some Tops cock penetrates into the sigmoid (aka the "second hole"). Both the colon and the rectum absorb fluid, but the deeper it goes, the more easily absorbed. i don't have to try to hold a Mans semen in when He impregnates me that deep, as long as i don't try to expel (never!!), it gets absorbed. Rectally? It's not unusual to reach a point where His seed is triggering/stimulating movement, in those cases i clench and resist the urge until the urge passes. With practice, i've found i can hold semen in indefinitely that way.
i do the same when a Man voids inside of me as well, though that always gets past the sigmoid making it easier to retain and absorb. i've often slept all night with a Mans piss in me without...issue. :-)