When they are young, dogs (and species of the dog family – wolves, foxes, etc.) constantly lick their mothers’ faces. It is believed that they do this to see whether she has food for them, presumably from a hunt.
The rather unromantic part of why dogs lick you is that you taste good. Humans are naturally salty to the tastebuds (yes, you are not sweet), and dogs’ heightened sense of taste seems to enjoy this.
Aside from seeing you, they feel more comfortable the more senses they can engage. So smelling you and tasting you are all part of a greeting ritual that sets them at ease.
An additional theory states that dogs would lick and clean their pack when members returned to a group. In part, this may have been to show respect and obedience to pack leaders. In that way, it is showing you that you are the alpha.
When a dog licks your hand and smells it, he can run a background check on you, so to speak. What were you last touching and eating? When did you last travel to Europe? Ok, not that last one, but it can tell a lot nonetheless.