|Dogs lick for a number of reasons. They lick to groom themselves and others. Mothers lick their puppies to clean them and stimulate their urination and defecation. Older puppies and the young of wild canids (relatives of the dog such as wolves) lick the mouths of the adults as a greeting to stimulate them to regurgitate. The puppies eat this regurgitated food as they are weaned from their mother and begin to eat solid food. As the puppies grow older, the licking becomes a way of welcoming others back into the pack and increasing the bonds between the pack members.
This last reason for licking (greeting and begging) is probably the one that has developed into the licking tendency of pet dogs. Licking is a way our pet dogs can greet us, say 'glad you're back!' and strengthen their relationship with us.