When looking out on a lake or stream, sometimes we can see a brown, funky "foam" in eddies or at a lake's edge. The sight of this foam immediately makes one think of soaps, detergents and pollution in general. These associations understandably lead us to assume that some manner of human-induced pollution is responsible. While it is possible that humans are to blame for the foam you see, it is more than likely just a natural phenomenon.
A quick test is to smell the foam. If it has a nice floral or perfume-y smell, it is most likely a detergent. If the foam smells fishy or "earthy," it's probably natural. Also, natural foam tends to be darker in color than the foam of detergents, though natural foam can be light in color. By law, the sudsing agent of detergents produced today must be biodegradable, meaning that the foam will be short lived if the detergent gets into a water body. This is in contrast to the late 50s and early 60s, when foam caused by detergents was a big problem.
Here's the nitty-gritty on foam formation. Water molecules want to cling to each other. At the surface, however, there are fewer water molecules to cling to since there is air above (thus, no water molecules). This results in a stronger bond between those molecules that actually do come in contact with one another, and a "film" of strongly bonded water (see diagram). This surface film (held together by surface tension) creates a considerable barrier between the atmosphere and the water. In fact, other than mercury, water has the greatest surface tension of any liquid. If the surface tension is reduced, bubbles are more likely to be formed due to the water's reduced ability to "regroup" after agitation. The greater the surface tension, the easier it is for water to pull itself together and force out trapped air.
The surface tension of water varies depending upon the dissolved materials in the water and the temperature. Organic compounds from decomposing plant or animal matter or from actively photosynthesizing plants can reduce the surface tension of lake or stream water. Both detergent and heat reduce water's surface tension, allowing the water to enter smaller pores and fissures. That process is great for forcing dirt out of your clothes. Hard water increases surface tension. Water softeners reverse this effect, reduce the surface tension and ultimately give cleaner clothes and sudsier baths.
On lakes, in bathtubs and in mugs of beer, the cause for foam is the same. Agitation at the surface causes air to get under the surface film of the water. Weakened surface tension is unable to force the air out, but rather keeps water wrapped around a volume of air, creating a bubble. If this happens for long enough, foam is created. On lakes, the agitation is usually due to wind, and the resulting foam will collect on the downwind side of the lake. In streams you will see the foam in eddies or floating downstream, and it is created by the flow of the water disturbing the surface film.