It is very important that you follow policies on where your dog is allowed and if it is supposed to be on leash or if it can be off leash. The top two reasons why are:
1. The more dog owners comply the more cities, counties and other governing bodies are going to become more dog friendly. I have helped with creating recreational policy and with getting research for making decisions on things like this. Dog's are more likely to be banned or have more limitations put on them if their owners are not following policy already in place. Where as I have also found that areas are more likely to open up to dogs if there are minimal complaints about them in areas they are allowed to access.
2. For your dog's safety and the safety of others using the area. There are several trails that allow dogs that are leash only. Many times these trails also double for equine (horses) and cyclists. "But my dog is perfect around those two groups do I really have to keep on leash?" YES. Because your dog might be fine, but the person watching with their dog may not be. If you allow yourself an exception it creates rationale for others to do so and their dog may not be able to handle it. Also to be frank, it is a jerk move to other people using the area who are not expecting an off leash dog.
Having your dog greet people and other dog's on trail
Okay next scenerio Dog meeting dog on leash. In general don't do it. But if you really want to the dogs should meet each other butt to nose and then butt to nose. Dog's are more nervous on leash than off. (which is why sometimes you find your dog listens better off leash) If two dogs meet and they are on leash they both are aware they cannot get away from the other quickly and they also have limited use of their body language. Dogs communicate to each other almost exclusively through body language. This meeting should be very short and quick. Do NOT let them play. If they get tangled in the leashes it can cause a dog to panic and a fight to ensue. Do NOT set your dog up for that situation.
Alright now for the fun stuff. Your dog greeting people and other dogs off leash. Now before I launch please be aware your dog should always be within eye sight and usually no more than 20 feet away from you. Your dog should come to you on command. If you have issues with your dog doing those two things you need to work with it to get it to do those two things before you are frequenting trails off leash. If you need help with that get a hold of me.
Alright your dog meet person off leash. This is one of the reasons its important to follow policy of areas on whether or not your dog can be off leash. If you are in an off leash area then anyone else using that trail is expecting to run into dogs. (If you are doing this in a non off leash area you are being a jerk to the other people using the are and to your dog.) Alright, ideally you see a person approaching again say something happy acknowledging the person and use a word like friend. (it is important to do that because if ever you are nervous about someone and you don't want your dog to instantly feel okay with them you don't use it. Your dog will notice and it will be more on alert.) I recommend teaching your dog a command called "polite" I use it with Stinker (my dog) ALL the time. Polite basically lets the person walk by your dog without your dog approaching them. It is important because although the person should be expecting to see a dog off leash they still may not want to meet your dog. Please also let the person know that your dog is friendly (if your dog is not friendly it has no business being off leash). What friendly means is your dog is not going to attack them or try to bite them unprovoked (aka unless they try to do something really stupid). If your dog approaches them you need to get to it ASAP (don't act panicked) and make sure you keep it moving along. If they want to pet it make sure your dog goes up to them first. I am going to through a quick plug in here YOU SHOULD NEVER PET A DOG UNLESS 1. It has approached you and seems interested in you petting it 2. you have asked the owner 3. the dog knows you are going to pet it. I had one idiot trail runner shoot his hand out to pet stinker last second. I thought he was going to hit her, apparently so did she because she instantly jumped away and growled. He nearly peed himself and I didn't feel bad for a moment. Granted I chastised Stinker for growling, but secretly I did not blame her. Slow movements please with all dogs. Alright again though only let the petting happen for about 5-10 seconds max and express for them to avoid your dog's face.
Dog meeting another dog on the trail of leash. Keep a sharp eye out. Not everyone's dog should be off leash. let the meet and greet be very short, and keep yourself and your dog moving through it. Somethings to watch for 1. if the dog has a muzzle on please keep your dog moving fast and if at all possible keep your dog from greeting the other dog. 2. if the other dog is on leash do not, if at all possible, let your dog greet it keep your dog moving. The on leash dog may not necessarily be aggressive, but it will feel very nervous by being approached by an off leash dog. Please remember people are hiking with their dogs to get exercise and with a time limit. Keep all interactions between the dogs short to be polite to the other person.
Other odds and ends
1. Strive to keep your dog on the trail as much as possible. This keeps your dog and/or you from getting lost in the woods. It also cuts down on issues about dogs causing issues with watersheds (that is as far as I have seen one of the biggest arguments being used with forest service lands about keeping dogs out or on leash).
2. Do not be shy in giving directions to people on how to interact with your dog.
3. Do not try to discipline someone else's dog. Worry only about your dog.
4. Do not get upset if someone without a dog is being a bit of jerk. As long as you are following policy they can be a jerk, but it doesn't matter. They are not worth your time. You are in the right. Do not engage with them.
5. Have fun! Enjoy the beauty in nature!