Training a dog to shake hands involves three steps. First, attract the dog's attention with food. Second, take its paw and say the command to shake hands, then reward it with a bite of food. Third, practice repeatedly until the dog associates the command with food and will obediently extend its paw.
How to train a dog to shake hands
When you first start training, use food to attract the dog's interest. Hold some of the dog's favorite food in your hand, use a commanding tone to make it sit down, and then reach out and grab its paw.
Every time you hold your dog's paw, say "shake hands" so your dog remembers the command. After your dog lets you shake hands, immediately give it a bite of food, and then shake hands again.
After repeated practice, the dog will understand that it will get a treat for making this gesture, and when it hears the handshake command, it will obediently extend its paw.