Gold was present in the deeps of Arda since its creation by Eru. It was no doubt discovered by Aulë, the great smith who was the first to make use of it. Afterwards, it was to be used by all speaking peoples of earth particularly the Dwarves who mastered it and by the Ñoldor.
It was used as currency for jewelry and many other things. It was to be found all over Arda particularly in mountainous places where the Dwarves lived and worked. Many dragons coveted gold, although they would usually just lie on a pile of it.
An example of where you can see gold used in mining is in the sword of Faramir to symbolize his high rank as the Captain of the Rangers of Ithilien. Also you can see gold in many items in the videogame The Lord of the Rings: The Third Age. The great smiths of the Dwarves and elves would forge gold in incredible works of skill and beauty, gilding great armors and weapons, as well as crafting amazing jewelry. Even the Vala prized and appreciated gold, working some of the greatest artifacts known.