Some people swear by enemas, but I have never found the need to use one, and doing them too often can mess with the natural balance of your digestive system. A lot of people anal douche. As in using something like a rubber bulb syringe, putting a little water in your rectum, getting rid of it, and repeating a few times until the water is clear. That is good for removing any little bits of stuff that might come off on the dildo, penis, etc, during sex.
As far as actually pooping or farting, I've never had a problem. It just isn't something that's ever happened. It's usually a good idea to kind of monitor yourself and your tummy and whatnot to make sure you're actually ready for anal sex at that point. If you're feeling a little rumbly or haven't gone to the bathroom recently, it may be a good idea to put it off until another night.