Really it is impossible to say for sure since we can't ask the dog. Healthy and astute dogs and cats that are well bonded to their humans are aware of and respond to your emotional state and behavior. When they look you in the face or the eye they are observing you, just like you might watch another person to see how they are feeling or reacting to something.
Eye contact in the animal world (including humans) can be viewed as aggressive in some contexts and animals often approach this with caution. You may notice some dogs make eye contact by giving a quick, humble-seeming glance then look away. This is a normal sign of respect / subservience. Other times you may see a small dog that is frightened of you and it stares at you and barks incessantly, exhibiting very aggressive behavior. Then just as with people there are the odd ones that just don't follow the norm and may stare at you in an adoring-seeming manner for hours like the breeds thought to be more people-pleasing like labs.
Some dogs and cats will look you in eye more than others. Staring can be aggressive or a sign of strong bonding so it is hard to answer question #2. If you are wondering about a particular dog you should be able to get an impression of their personality just by watching them.
Like most behaviors is is probably influenced by both learned and genetic factors.
This can be studied by observing sibling pets that were raised together, the same way. Differences in behavior suggest genetic factors at play (while similar, siblings have different genes and can behave and look differently). The learned behavior side of things can be explored by training a dog to look at you more or less by rewarding them following the desired behavior.