All healthy dogs have four primary toes on their legs and almost all of them also have one additional fifth toe on their front leg. This fifth toe is called Dew Claw. It is almost on the same spot as thumb on human hand, that is why they are sometimes reffered as dog thumbs.
Almost all dogs have dewclaws on their front legs, but not all of them have hind dew claws. It is work of evolution again, since front dew claws still have some purpose, hind dew claws are completely useless. There are also dogs with double dewclaws. When a dog has a double claw on a leg, it’s called polydactyl and there is nothing wrong with it! For some breed it is actually breed standard requirement. Great Pyrenees or Briard must have double dewclaws if they want to participate on official dog shows.
Find out, what is the real purpose of dewclaws in this video: