The short answer for the best place to install pool solar panels is near the pool but in a spot with the most sunlight. In some cases, that will mean roof installation. In others, it will mean a ground-level solar pool heating system adjacent to your pool area, or even atop a shade structure in your yard.
In addition, keep in mind your collector's tilt angle. Optimally, it should equal your latitude. However, most pool owners prefer their solar collectors to go flat on their roofs because it's usually more aesthetically pleasing (1).