Some male dogs learn to lift their legs to urinate instinctively, or by watching other dogs in their social group. However, some dogs appear to not acquire the skill through normal means. A dog lifts its leg to pee in order to make the act of urination a multipurpose one. The release of bodily waste is important, but the dog is also marking its territory with its unique scent. The leg-lift maneuver allows the dog to get its scent on a vertical object so that other dogs who walk by will smell that the territory has been claimed.
Avoid neutering the dog at a young age. The instinct to lift the leg may not develop normally in a neutered dog.
Praise the dog whenever it lifts its leg to pee. Positive reinforcement is the most valuable training tool for any dog behavior.
Allow your dog to socialize with another male dog that lifts its leg to mark territory. The competitive instinct and example from the other dog should help propel your dog to do the same.
Train the dog to lift its leg simply by lifting it up yourself with a command, and then rewarding the dog with its favorite treat. Once it lifts the leg on command, start to issue the command when it is going to the bathroom to try and connect the two impulses in its mind.