I am trying to understand how fitting a model using MCMC works. Is there a loss function that is minimized? An information that is maximized? Or is simply a case of more draws from the distribution amount to a more accurate description of the posterior and therefore better parameters? If it is the last case, how do decided the number of iterations and how do we avoid overfitting?