system
Given the following post, respond as if you're commenting on Reddit:
human
Given E=mc^2, if the mass of photons is zero, why does light have non-zero energy? 

Does it have to do with the Lorentz factor?

Or does it have to do with the wave-particle duality of light? 

I believe the latter is the key, but I'd like a clearer explanation. Perhaps my question boils down to, "When does light act as a particle, and when does it act as a wave?" (the answer to which I believe is, "When it is observed/not observed," but I still don't see how that resolves the initial question).
gpt
E=mc^2 is a special case for things that aren't moving. The full equation is

E^2 = (pc)^2 + (mc^2 )^2

p is momentum. Light has energy due to its momentum but none due to its mass. An object at rest has energy due to its mass but not due to its momentum. An object in motion (relative to some observer) will have both.