Male dogs will raise their legs while urinating to aim higher on a tree, hydrant, or pole because they want to leave the message that they are tall and intimidating.

Some wild dogs in Africa try to run up tree trunks while they are urinating to appear to be very large!

On a similar note: In Croatia, scientists discovered that lampposts were falling down because a chemical in the urine of male dogs was rotting the metal. Whatever works, I guess!