Why do male dogs lift their legs when they have to go?

Dogs use their urine as a scent marker. Like a “calling card.” Many male dogs and some females will “mark their territory” by urinating in many places. By lifting his leg a male dog is getting his urine on a vertical surface (fire hydrant, street sign, mailbox ). One theory is that these vertical surfaces allow the scent to last longer than horizontal surfaces. Another theory is that this is more noticeable to other dogs because it’s closer to nose level and thus less likely to be missed.