Male dogs don't lift their legs to urinate from birth, but as they grow, they may develop the habit of hiking one leg when they relieve themselves. This behavior isn't unique to males, but it is more common than it is in females. Both neutered and intact males generally mark their territory more than females do, and when one leg is lifted, hitting the target is easier.
Learning to Mark
When a male dog is about a year old, he may start lifting up one of his hind legs when he urinates. This isn't a universal trait -- some males still prefer to squat when they go -- but it gives the dog greater ability to urinate on a vertical surface. Male dogs do this as a way of marking their territory -- before they're neutered, they also may do so to advertise their virility and availability to female dogs in the area. Even a dog neutered before turning a year old is susceptible to learning this behavior, as it enables him to easily aim at a vertical surface as a way of "claiming" it as his own -- a practice more common in males than females.
References
Writer Bio
Tom Ryan is a freelance writer, editor and English tutor. He graduated from the University of Pittsburgh with a degree in English writing, and has also worked as an arts and entertainment reporter with "The Pitt News" and a public relations and advertising copywriter with the Carnegie Library of Pittsburgh.