Dogs mark their territory by urinating on them to signal that it considered to be theirs. Doing this lets other dogs know that they are present when others sniff around to investigate. Apart from using it to define territorial boundaries, it gives information, like a profile of their reproductive status and where it is on the social hierarchy. Dogs that have their reproductive system intact i.e. not neutered or spayed, are more prone to marking.
Other triggers that causes dogs to mark are from excitement like males noticing a female in heat, or male dogs in contact with other male dogs. Overstimulation from highly social interactions may also cause a dog to mark. In this situation, the dog might mark other nearby dogs, objects or people.