It's caused by poo! While some areas have sewer overflow that have issues with human waste getting into the waterways, other areas have problems with geese, ducks and other animals, all which can have an effect on e.coli levels. You can get very sick if you consume water that's contiminated.
Ecoli is measured in a lab and it takes 24 hours to get your results. The lab give you special containers and teach you how to make sure your sample isn't contiminated.