Suspended Sediment Concentration in the San Francisco Bay, USGS. Click here for a larger version of the image.
Much of the gold extracted from the Sierra foothills during the Gold Rush was in placer deposits. That is, it was mixed with the rest of the sediment naturally eroding from the mountainside. Flecks of gold have a greater density than almost all the other particles and, thus, can be concentrated through natural water movement. A similar process is seen when you go to the beach. When the mixture of minerals and waves are just right you might notice darker grains of sand creating streaks or patches in the wet sand.
Miners had to devise ways to extract the gold because it was still a minor component even in rich placer deposits. Methods like panning and simple equipment like sluice boxes were used with moving water to enhance the natural mineral separation process.
When all this relatively easy-to-get gold was extracted from the streams and rivers prospectors turned to hydraulic mining to obtain the riches. Hydraulic mining was the process of using high-powered water canons to artificially erode gold-bearing hills made of sedimentary deposits. These sedimentary deposits were ancient stream beds that contained gold in placer deposits much like the modern streams did. Essentially, hydraulic mining eroded ancient river sediment from the hillside and diverted the material into the modern river where miners then extracted the gold.