Why do gold deposits form only in certain areas of the earth?
I'll take the form of the question given by another person here and attempt to provide a different answer.

So what you are asking is: "How did gold become so concentrated in certain parts of the world?"

So yes, gold is all around but the concentration is too low to make extraction of it worthwhile. You need some process to take small amounts of gold from a large volume and turn it into large amounts of gold in a small volume where it is convenient to build a mining facility and get it from the Earth.

One of the most common process to concentrate gold is through the action of hydrothermal fluids. This is basically heated water flowing through the Earth's crust. Heated water with certain properties such as acidity (pH) or dissolved anions (think chlorine-rich seawater is more corrosive than your tap water) can dissolve solid gold and put it into solution. Just like regular water can dissolve table-salt or sugar and put it into solution.

So you have this hydrothermal fluid flowing through huge masses of rock (mountain-like, but underground) for a very long time, and when it goes up to the surface, it is channelled into thin conduits of fluid flow. During their ascent the conditions change (be it temperature or pH, etc.) and the water are not capable of carrying gold with them anymore. This results in the deposition of gold in that specific region.

I made an example, that I hope will help you understand this in a clearer way:



So in here you have rain water, entering the Earth in a large area and getting hotter as they descend down. It becomes possible for them to dissolve the gold from the large volume of rock.  But also, because the water (now steam or a supercritical fluid) are hot they start to ascend upwards, usually through a narrow zone. When they cool down again, gold forms as a solid. For example, gold associated with quartz veins commonly forms through this process.

Now, what happens if these gold-bearing quartz veins are exposed on the surface? They may erode by rain and snow and get concentrated in river beds. So you can either mine the original quartz vein or the nearby river bed.