How does shadow work:
Well you are basically accessing a remote PC, what allows you to do so with minimal “lag” is the ever-improving internet global infrastructure, and recent technological advances in video encoding and decoding.
What are video encoding and decoding? Well its basically the compression and decompression of a video, recent technologies (H.264 and H.265) allow you to compress a very high-quality video in a low bitrate stream, and a dedicated hardware decoder, which any 8 years old or younger GPU should have, is what allows you to decode a video in real time.
For more info on H.245 and H.265 and Hardware decoding and how to check if you have it, see:
Interesting article about how h264 works (external link) - H.264 is magic.