Dogs also lick because they like the taste of an owner's salty skin and out of habit.
Mostly, with domestic dogs, it's a sign of affection.
Licking releases pleasurable endorphins which gives dogs a feeling of comfort and pleasure like the feeling people get when they are biting their nails it relieves stress.