Most cities around the world (except some cities in the US) are "strategically" located near a river or on shore. Because of that, pretty much the whole world live near a river or sea. The most strategically located cities "become" a trading hub and these days have become large cities.
It's well worth mentioning, however, that if the people in the city (who where strategically located for trading) didn't adapt to the changes in the world conditions, then these cities simply disappear or become much less relevant. Many cities of the world would have lost this privilege due to digitalization and the sea becoming safer.
It's impossible to separate the people from the social institutions which do create the opportunity in the services sector which dominates modern advanced economies.
In the Bay Area/SF the digital economy is defined by the ecosystem of big tech, VCs, thousands of software engineers and maybe tens of thousands of support services like accountants.
not sure this is a good example - while it's true for actual gold mining, in the case of software developers, having other software devs around (plus also good computers, which you could argue is like gold) can be an opportunity in itself - look at all the devtools startups that happen in the Bay Area.
A large group of people is an opportunity in itself.