The only thing in the air that produces power is oxygen. The more oxygen contained in a fixed volume of air, the more power you get.
Temperature, humidity, altitude, barometric pressure all affect HP because they all affect the amount of oxygen in a fixed volume of air.
Higher temperature means the air is less dense. Less dense means less oxygen in a fixed volume.
Humidity is just water vapor in the air. More water vapor means less of everything else, including oxygen. It is actually better to use dewpoint instead of relative humidity for the calculation since dewpoint does not change as radically through the day as relative humidity typically does.
Increased altitude means less dense air. Less dense air means less oxygen in a fixed volume.
Lower barometric pressure by definition means less dense air. We all know what that means!
As an example, at 85 deg F, 30.14 in-Hg barometer reading, 58 deg F dewpoint and 5000 ft altitude, the engine only produces about 81.1% of the rated horsepower.
There is a very dense paper on the subject; SAE J1349 Revision JUN90.
[This message has been edited by Lud (edited 28 August 2001).]