I consider it a matter of mutual respect. Early humans and dogs are both pack hunters and likely stalked the same prey.
I figure dogs were pretty impressed with our take-downs and were glad to share the spoils, and vice versa. Throw in a warm fire and you got yourself a friend.
It's lucky that there were innate characteristics in dogs' ancestral species, which allowed for their domestication.
Tail-wagging in juvenile wolves and foxes was selected for in adult dogs. Their acutely sensitive hearing and olfactory sense complements our eyes etc.