Power comes from burning fuel in the cylinder. The more fuel and oxygen one can cram into an engine's cylinder, the higher the potential power output.
Cooler air is more dense and contains more oxygen molecules per unit volume than warmer air. If there is a greater quantity of oxygen molecules present in the cylinder than would be otherwise, then there is an increased probability that a greater quantity of fuel will be burned, resulting in more power. Conversely, warmer air results in less power.
Injecting water, as an aerosol, cools the air, making it more dense. This effect is exactly the same as that of "swamp box" air coolers. The principle is liquid water absorbs heat in changing from liquid to vapour. The heat comes from the surrounding air, thus cooling the air.
High humidity air contains water vapour, but as no liquid, per se, is vaporized, there is no cooling effect. The water vapour "crowds out" oxygen, and less power results.
Water vapour in the cylinder suppresses detonation. The theory of how it does so, is beyond this discussion.
The above does not differ from what JimNH posted in reply #15, but is intended to explain the physical principles.
Slick