It's easy to train your dog to handshake, some varieties such as German shepherd do not even need to be trained, when you reach out your hand, he will also give you his paw, which means he knows what you want him to do. On the other dogs, as long as you train them simply, they will get it soon.
When training begin, let your dog sit in the face first, then reach out one hand and say command "shake hands". If the dog lifts up one of his forelegs, you can hold it and shake gently, as well, say "hello" to him, which is not only a reward but also handshake etiquette.
After several such training, your dog will be more and more skilled. If the dog don't lift up his foreleg after giving the command "shake hands", push his left shoulder, which can let the center of gravity move to the left forelimb, at the same time, hold his right forelimb, then lift up it and shake, say "hello" to encourage him, as well, the dog should keep the posture sitting. After several such training, your dog can reach out his foreleg to shake hands with you quickly according your command, at the same time, say "hello" to him continually. You should show him you are very happy, which can inspire the dog.
Handshake is also a way to exchange feelings between owners and dogs, and dogs are easy to obey this action. So, when your dog is happy, maybe, he will take the initiative to reach out his foreleg and shake hands with you.