Dogs go into different stances depending on whether they’re peeing or pooping, and by running a hand down the dog’s back, the handler can figure out what’s going on. If the dog’s back is flat, it’s peeing — male guide dogs are trained to not lift their leg when peeing; they utilize the same “lean forward” pee stances that females use — and no cleanup if needed. If the dog’s back is rounded, handlers know some cleanup will be required. By feeling their way down the dog’s back to its butt and tail, they have a pretty good idea of where the poop is going to wind up. Once the dog is finished, the handler just leans down with their plastic bag and can find the poop pretty easily.
Red more about their special potty training at the link.