Water Quality is tested and measured by the Environment Agency. They take regular samples between May and September and test for pollution.
Many factors can influence water quality.
Rainfall is a significant factor as a lot of water falling on the land can cause runoff from agriculture or from the moors which can sweep large amounts of murky water containing elements of those areas such as byproducts of animal grazing into the river which then flows into the sea.
There are also storm outlets in some areas which take the overflow of water from the sewer system and there can be cases of pollution from other sources.
It's usually advisable to leave the sea to be cleared by the tides for 24 hours after significant rainfall or if it looks a bit unpleasant.
Apps such as Surfers Against Sewage use the information supplied by the EA and weather forecasts as well as local area knowledge to predict pollution levels