How does global illumination work

I am very intrigued on how people can make ray cast effects on roblox studio using scripts and things, but considering I joined roblox around 3 years ago and started scripting like a year ago, i always wanted to improve my showcase games. How does ray casting work and how do they virtually replicate the effect using scripts and produce some reflections?

I know they use scripts but the main question is where do they place it and what are the basic code that changes the way light interacts?

Ok so this is really complicated and really hard to explain and would honestly take me forever, so I would recommend watching a youtube video.