The concept is fairly simple. Higher temperatures makes the air less dense (less air in a given volume than with cooler temps). Higher altitude also makes the air less dense (due to the lower atmospheric pressure at higher altitudes). So the hotter and/or closer to sea level requires a larger jet (more fuel) to keep the air/fuel ratio at an optimal mixture. Run the mixture too lean (too small of a jet) you run the risk of burning pistons or valves from a hotter combustion. Run the mixture too rich you run the risk of fouling a plug. Richer is safer than lean, but lean makes more power.