Well, kinda like getting a worm out of a hole in the ground. Grab hold and give a steady pull until he drops. There are cleaners on the market (mostly containing tea tree oil) formulated to clean the smegma (oily secreations) from the sheath. My guy has never had a 'bean' but from what I understand, sometimes a ball of smegma can get lodged in the urethral opening. Not sure how to get this out as I wouldn't think going in after it would be the best course (too much potential to push it deeper into the urethra).
Suggestion: tie a front leg up before doing this for the first time to prevent a cow-kick if your boy is a bit sensitive about having his sheath messed with.