Socialization is about building positive associations with the things that a dog is going to come across in it's lifetime. Things can include the sound of a train, other dogs, walking on different surfaces, people with glasses, people with beards, people with backpacks, and the list goes on.
The point of socialization is to have a well balanced dog that really enjoys the presence of the things mentioned above. A lot of dogs are inside a house for 23+ hours each day. The time they are outside is to relieve themselves and doesn't last long. If they finally get to go out on an adventure, (either because their human brought them along or because of bolting out of the front door) they don't really know how to handle themselves. They are overwhelmed. Imagine if you only left your house once every couple of weeks. You'd probably be a little overwhelmed too once all of the elements of the world hit you.
Trainers harp on this so much because a lot of behavioral issues can be prevented if socialization is done properly and continuously. Another thing about socialization is that it's never over. This must be continued on throughout a dog's life. It's definitely most important at a very young age, but older dogs can be affected like lack of socialization.
So let's talk about how and where to do it.
These are equally important. The first rule is to always have something that your dog loves. The easiest thing to bring along is small pieces of food. If you do bring food, make sure it's something that would be considered "high value" to your dog. There are lots of great high value treats out there and you can also bring things like turkey, chicken, hot dogs etc. Once you have your high value item you're ready to hit the streets.
There are some important rules to socialization. One is to make sure that you introduce the high value item a second after your dog experiences the person, dog, car etc. You want to continue to give your dog a few things while the thing is still present. Once the thing goes away, or ends, stop giving the high value object. An example is if a loud truck goes by. As soon as your dog notices the loud truck, start giving him high value stuff until the truck goes away. This will teach your dog that when loud trucks go by, awesome stuff happens. If your dog associates loud trucks with awesome stuff, your dog will not be afraid in those situations.
Another important rule is to make sure that there is enough distance in between your dog and the novel stimulus. You wouldn't want to get your dog directly next to the loud truck to start. Start off at a distance where your dog notices it, but isn't overly concerned. Start to close the distance as your dog gets more and more comfortable.
When it comes to socializing with other dogs there are some rules as well. It is recommended to keep on leash initial meetings under 5 seconds. Typically if something goes poorly it happens after the dogs have been in close proximity for too long. After those initial seconds, call the dogs away and give them lots of high value stuff. You can repeat that exercise a few times and if everything goes smoothly, you should be fine to increase the amount of time they're together.
Socializing with people can be a bit easier since you can tell people what to do. Overall it's a great idea to pair people with food. Depending on how your dog currently feels about people, you can either give your dog treats when he is in the presence of people, or if your dog is pretty comfortable around people, you can give them treats to give to your dog. For any dog that is very nervous of people, we recommend having the owner deliver the treats. Dogs don't necessarily generalize people very well when it comes to socialization. Make sure that you find people with hats, back packs, beard, different skin colors, skateboards, costumes, you name it. Make sure to do this in different contexts as well. You want to practice this out and about, as well as in your home with people coming through the door.
The overall idea is to get your dog out and to have a lot of fun while doing it. Make sure you bring lots of awesome stuff and give it to your dog when stuff changes in the environment. You can also use small tasty treats to reward your dog for doing behaviors that you enjoy. (Walking on a loose leash, sitting at cross walks and leaving objects from the ground.)
For a nice visual of how to socialize your dog, check out this video: