The price is determined through buying and selling in the derivatives markets and gold fixing provides a benchmark.
As for gold and oil there is no exact relationship and at times they don't go together based on what is happening at the time (shocks, commodity-specific news, etc.), but generally they correlate because they are both commodities and safe havens from currency or currency-backed stocks essentially.