How do Dogs know that they will see their Master for the las

 
How do Dogs know that they will see their Master for the last time?
One time I Help my Uncle to get His stuff out of his ex wife house in my truck and my Uncle had His Truck
and before He left all His Dogs line up to get a hug from my Uncle after that my Uncle never came back to
his old house and He Live for about 2 Years before He Pass Away.
They didn't know they were just wanting affection from the pack leader
Dogs pick up on feelings and emotions a lot better than we do, and can sense when we're not happy, anxious as well as all the good feeling. Your Uncle obviously knew he was leaving, and the dogs picked up on it.