As you increase your altitude the octane requirement decreases 1-2 octane per 3000 feet elevation. This is because the density of the air is reduced so there is less air available for your motor to burn. The fuel volume remains the same and the air volume goes down. As the altitude increases, the motor makes less vacuum and the air fuel ratio becomes richer due to the decreasing air to fuel volume. The higher the altitude, the richer your motor will run, making it necessary to re-jet the motor in order to lean it out.
As the air density increases, your engine will lean out. As the air density goes down, the engine runs richer. Like driving up a mountain, at the top, the motor has less power because you have less air to burn.
When the temperature goes up, the air density decreases, thus you have less air available for combustion and your air fuel ratio becomes richer. The same works in reverse. As the temperature goes down, you end up with more air per cubic foot, and without re-jetting your carburetor, the engine will run leaner.
When the humidity increases, octane requirements ease. The formula is something like… for every one gram of water increase per one kilogram of dry air the octane decreases by .25 to .35.