Easy. Use the same technique humans use to train other humans to have sex with them.
</snark>
We have never "trained" an animal to have sex with us, and we can't respect anyone who would feel the need to attempt to. We may "test the waters," same as humans do on dates. But train? No. We like to describe it as "inviting" our animals to have sex with us. If they're game, they do. If they're not, they don't.
Now, on the other hand, if you mean "learning together what you like most or want most" as far as sexual interactions go, then again, ask a human what they do with other human partners. They praise/discourage verbally and by body language. They learn together, through experience, organically. Harder if you don't share a language, sure (dogs can't do the pillow talk thing as articulately as humans might). But not impossible. Nudging, guiding, vocalizing pleasure or discomfort. ... Same.
IOHO, it's pretty much the same. It's an evolution, getting better and better with familiarity -- but we don't call that "training" each other. We could, maybe, but not really the same nuance. Maybe if we were Master/slave. But naw, it's just part of the growth of being a sexual couple/partner. If you're not a sexual partner in the first place, the concept of "training" is abuse.
Most dogs by nature want to please you, so let it suffice that "training" is simply letting him/her know "This pleases me. This other, displeases me." Really, that's all there is to it at our house. But dogs also should have a say in this. They also get to let you know, "I find this displeasing. This other, yeah-yeah-yeah -- mucho pleasure!" Two-way communication like that, key to happiness in just about any relationship you can name.
All that said, trying to get your dog to "fuck you in the ass" or trying to get him to let you fuck *him* in the ass, that's going to be difficult if it's not something he shows a propensity to already, something you can encourage. Otherwise, you have a chasm to cross there with not much bridge-building material to work with. Seize the moment if it ever presents itself. Build from there by letting him know you like that and want more. Little by little it will either come about or become clear to both of you that it's not going to happen.
Hope I have said something that makes sense. If not, well, it's just what makes sense to us, and we're just one couple in the universe. Cheers.