But why do dogs feel compelled to roll on dead fish? No one has yet answered this.

A dog has a few key drives: it needs food and water. It needs exercise. In particular it needs to behave within the confines of its inherently programmed social behavior. This last one makes it very valuable to humans. The dog seeks to find a place in a pack-like group, which in most cases is a human family and perhaps some other dogs. The dog feels compelled at all times to have some sort of territory and make its presence known to other dogs, males more obviously than females. Males will urinate near trees and posts, especially. They do this so that other dogs will notice their presence by smelling the unique urine odor.

All dogs, also, want to have a unique odor which accumulates in areas they like to frequent, and make other dogs aware of their presence. Dogs like to make this odor as strong as possible, and the extremely pungeant odor of rotting fish flesh works very well. After your dog has rolled in the fish, you can smell it from a long ways away. To your human nostrils, he/she seems much more stinky than usual, and is detectable from a greater distance. To your dog, the greater smell is all that matters. It thinks, I know I can be smelled from farther, so other dogs know that I'm to be reckoned with. Rolling on dead fish fits the bill perfectly.

It seems to me that What dogs do on freshly cut grass, is the same action (rolling on it) for a completely different reason.