While shaking, our hand moves on a curved path with some angular velocity and water on our hand feels centrifugal force in the outward direction. Therefore, water get detached from our hand and leaves it.