Heat pumps take advantage of the sun warming the air around your pool.  The heat pump draws in this air and passes it over an evaporator coil which absorbs the heat.  The heat is increased when it passes through a compressor and then the heat is transferred into a condenser where it is transferred into the cooler pool water.
Because heat pumps draw heat from the air they begin to lose efficiency when temperatures are below 45°-50°F which isn’t an issue for most areas, but if you do like to swim in the dead of winter you will be better served by a gas heater.