One of the sages, Reish Lakish, warned about four things endanger people due to evil spirits and demons to be found in their vicinity.
1. Relieving oneself between a palm tree and a wall.
2. Passing between two palm trees.
3. Drinking borrowed water.
4. Passing over spilled water.
The scholars were more precise and explained the special conditions pertaining — when the evil spirits and demons are to be found and endanger life and when the evil spirits and demon are not harmful.
Relieving oneself between a palm tree and a wall — specifically when there is a small distance between them and the demons have no other way to go. If the distance between the tree and the wall is large or there is another path, evil spirits and harmful demons will not be present and one may relieve himself between a palm tree and the wall.
Passing between two palm trees — specifically when there is no path between them which is used by many people.
Drinking borrowed water — specifically when a child borrows it in a field where water in scarce. In these cases the demons are harmful, but if one borrows liquor or wine, or water within a city, or if an adult borrowed it, one may drink the liquid, for demons do not habitually cause harm in these cases.
Passing over spilled water — demons and evil spirits are harmful specifically when dust was not scattered over the spilled water, when no one spit into the water, or if the person walked barefoot in the water. They are especially harmful at night and if 60 people did not pass over it. If one of the above conditions has been fulfilled or if the person is riding a donkey such that his feet do not touch the water, the demons will not harm him.
These conditions only apply in warding off harmful demons. If there is suspicion of witchcraft, even the conditions mentioned above will not ward off the danger. An incident once occurred in which a man, riding a donkey and wearing shoes, passed over enchanted waters. His shoes shrunk and his feet dried up due to the sorcery in the water.
(Babylonian Talmud, Tractate Pesachim 111a)