Earthworms do not have eyes or ears.
Instead they have light sensitive cells on the surface of their bodies to tell them the difference between light and dark. Worms do not like light, and tend to stay underground during the day, coming out at night to look for food.
They are also sensitive to pressure change and vibrations allowing them to adapt quickly when they feel the tapping of raindrops on the ground. When worms detect rain they will rise to the surface to prevent themselves from drowning.
Interestingly, there are world-wide worm charming competitions and champions use this trait to charm the worms out by tapping a stick on the floor to recreate the effects of rain drops vibrations. So next time you see a random person hitting a stick on the ground numerous times, don’t be too alarmed!