The mean tilt of sunspot bipolar regions: theory, simulations and comparison with observations