Why do dogs roll in dead animals?

The current theory about why dogs will roll in smelly material comes from on their relationship to wolves and observation of wolf behavior. Wolves will often roll in decomposing carcasses or the feces of plant eating animals or herbivores. It is assumed that this masks their own scent and enables them to sneak up on their prey without detection. It may even fool members of the other species into accepting a wolf as one of their own. It is assumed that this instinct is what we are seeing in the behavior of domesticated dogs as well. Working and hunting dogs tend to roll in smelly stuff more often than other breeds and this is perhaps because they are more closely related to wolves.