It's using existing mechanisms in YouTube's JSON API to find suggestions and play them. All the true "magic" is provided by YouTube's engineers. Not to take it away from someone who writes the right lines of JavaScript at the right time, but you don't have to place the guy on a pedestal.
The real lesson here is for yourself and others here who think like you -- if you tell yourself that things like this take superhuman efforts, how will you ever be able to produce something creative yourself?