After they’re neutered or spayed, many male and female dogs continue to mount and even masturbate because they have learned that the behavior feels good. Intact (not neutered) males will often masturbate if prevented from approaching a female in heat.