The law of inertia.
The inertia is the resistance of a physical object to any change in its state of motion. At that time that the animal shakes, water drops resist to move and separate from the animal. There is a surface tension between the water and the hair of the animal. When the animal shakes, a centrifugal force (an inertial force) pulls the water away. So for the water to be ejected from the fur, the centrifugal force has to exceed the surface tension.
Image Source and demonstration: You Tube