Hi!
I'm by far no expert, but I'll give this a shot.
As per the first question. How the script works. Almost all scripts available originated from (read: stolen) Coinhive. They created a javascript mining script that is capable of mining cryptonight based coins. Basically, my understanding is that they took C/C++ source code for a mining script, compiled it to JS via Emscripten, and have a functioning miner in webpages, because of that.
About the speed. Yep. It's slow. Very slow. Basically, whether the browser uses JIT compiling or not, the process is going to be far less efficient than running bare metal, so those numbers sound pretty much right on.
Every different site uses a different payout method. Most are going to pay out in Monero. (XMR). That is the cryptonight coin that most web miners choose to mine. The catch is, lots of these sites have a high withdrawal limit. Say, .3 XMR. It's going to take a while to earn over 60 dollars using a webminer... So you'll want to be careful about the minimum withdrawals supported by whatever site you use.
About your calculator.
No.
In that hypothetical situation, you will not be earning anywhere near that sum, because of one important thing, that most web miners don't make obvious. HUGE fees. Coinhive is (or was. Don't know as of now.) 30%. So that means, in that case, you wouldn't earn 20 XMR. You'd walk away with about 14.
So how do you calculate how Coinhive gets their payment method?
Well. Let's go in reverse.
So we know they pay: 0.000029 XMR per 1Million hashes.
So that means that they pay out: (.000029 / 1,000,000) XMR per hash solved.
Let's use your example with 20 H/s and 10,000 miners.
You'd be making 200,000 hashes per second. 200,000 * (.000029 / 1,000,000) XMR / Second.
Multiply this out to months. (200,000 * (.000029 / 1,000,000)) * 60 * 60 * 24 * 30 = ~ 15.0336 XMR / month.
So I wasn't that far off, with my first guess.
To be perfectly honest, it is hard to make money using web miners. You're going to need to do lots of hard work, and have lots of luck.
If you have any other questions, I'm more than happy to answer them.