while that page is running they are just checking you are a single user and not part of a robot army.
And to be clear, they're not doing some sort of weird ID check or something - it's just making your computer solve a hard maths problem that takes seconds to solve. (And it will be slower on less powerful devices).
It's making it computationally infeasible to overload the server - the doorkeepers get to immediately turn away clients that haven't done the necessary work, with just a quick glance.
Cartoon illustration taken from Wikipedia's Proof of Work article.
The solving only happens periodically as the "response" is repeated by your browser on all subsequent requests, so you can skip stages 1-4, until the server decides the response is "stale" (time out or overuse).
And what the diagram here doesn't show is that there are multiple "doorkeeper" servers spread across the world, which can take over from each other if one gets overloaded (there's another server monitoring the doorkeepers, changing which ones the URL points to according to their load), and the "granting service" after step 6 is actually forwarding the request through to the real server.
Fascinating techy stuff...