Epigeic worms live near the surface of the soil. They burrow into leaf litter and around the edges of manure and compost piles, but are never found deep underground. Their tunnels are just below the surface and run almost parallel to the ground. Endogeic worms tunnel a bit deeper into the soil, creating long, sloping tunnels in a constant search for food. Deep in the ground, sometimes as much as 10 feet down, are the anecic worms. These worms are almost never seen during the day under normal conditions, but often come to the surface at night to search for food.
Any type of worm is driven to the surface by disturbances in a normal environment. These include rain or lawn sprinklers, which fill worm tunnels with water and send the worms scurrying to the surface to avoid drowning. Chemicals also cause problems for the worms, irritating their skin and forcing them out of the ground to get away from the source. Some fertilizers and pesticides drive worms of their tunnels at any time of the day. Knowing this, fishermen use a dilute mustard solution to bring nightcrawlers out of their holes to be used as bait.
Worms don't have any eyes, but they are still sensitive to light. If a worm is exposed to light for too long, usually about an hour or more, the worm becomes paralyzed. Once it is paralyzed, the worm dies. If the day is heavily overcast, the worm is able to survive longer than an hour in the light. Eventually, however, it becomes paralyzed and dies if it is not able to reach the safety of darkness before paralysis sets in. If a worm is driven from its hole and crawls onto concrete, there is no way it is able to tunnel to safety.
If an area has been treated with pesticides, the worms were likely driven to the surface by the chemicals. Carbaryl and imidacloprid, common pesticides used to treat a variety of lawn pests, are highly toxic to earthworms. Worms that make it out of their tunnels after being exposed to these toxins die anywhere, including on the patio or sidewalk.