In a recent paper [P. V. P. Cunha, C. A. R. Herdeiro, E. Radu, and H. F. Runarsson, Phys. Rev. Lett. 115, 211102 (2015).], it was shown that the lensing of light around rotating boson stars and Kerr black holes with scalar hair can exhibit chaotic patterns. Since no separation of variables is known (or expected) for geodesic motion on these backgrounds, we examine the 2D effective potentials for photon trajectories, to obtain a deeper understanding of this phenomenon. We find that the emergence of stable light rings on the background spacetimes allows the formation of "pockets" in one of the effective potentials, for open sets of impact parameters, leading to an effective trapping of some trajectories, dubbed "quasibound orbits." We conclude that pocket formation induces chaotic scattering, although not all chaotic orbits are associated to pockets. These and other features are illustrated in a gallery of examples, obtained with a new ray-tracing code, PYHOLE, which includes tools for a simple, simultaneous visualization of the effective potential, together with the spacetime trajectory, for any given point in a lensing image. An analysis of photon orbits allows us to further establish a positive correlation between photon orbits in chaotic regions and those with more than one turning point in the radial direction; we recall that the latter is not possible around Kerr black holes. Moreover, we observe that the existence of several light rings around a horizon (several fundamental orbits, including a stable one), is a central ingredient for the existence of multiple shadows of a single hairy black hole. We also exhibit the lensing and shadows by Kerr black holes with scalar hair, observed away from the equatorial plane, obtained with PYHOLE.