@MrWizard I'm glad it works!
@iopqThe chance is equal for each share, yes, but the more "bad" shares you have in a row the less likely it is for you to continue getting only bad shares. If you flip a coin 10 times you don't have a 50% chance to only get heads or to only get tails just because the chance is 50% when you toss the coin once. For example, if a pool is currently at 0.1 * D into the current round it's much more likely for the round
not to end in the next 0.5 * D shares than it is if you had 9.5 * D shares. It's quite likely for a round to get to 0.6 * D shares, but it's very, very unlikely for a round to get to 10 * D shares (this is plainly visible, I don't even know if any pool ever had a round that long).
On average, you find a block every D shares and each share has the same chance of being the "good" one, so they get a 1/D chance.
The chance to find a block on the first share is 1/D. The chance not to find it is 1-1/D
The chance
not to find a block on the 2nd share (if we're at the 2nd share it means the first one was "bad") is (1-1/D)*(1-1/D) = (1-1/D)^2 (the probability of the 1st share being bad multiplied by the probability of the 2nd share being bad, which is, as you've pointed out, the same)
The probability of
finding a block on the 2nd share is 1-(1-1/D)^2
Now if we keep on doing this for N shares, we get the probability to find a block after N shares:
1-(1-1/D)^N
1/D is obviously a very small number but larger than 0 and certainly under 1.
1-1/D is therefore also less than 1
(1-1/D)^N is therefore getting closer and closer to 0, the larger N is. This is to say, the chance of
not finding a block is getting closer and closer to 0 the more bad shares a pool gets. The chance to actually find the block is therefore getting closer and closer to 1.
If you mine a round when the chance of the block ending is very close to 1, you're essentially almost certain to be mining in the PPLNS payment window, because it's very, very unlikely for the round to go on much further and for the payment window to move past your shares. If you're not missing the payment window you're not making any less than on a backup pool, but a few of your shares get the chance of being paid for twice if the next round is short and the payment windows overlap (and shorter rounds are more likely than very long ones).
You have no clue exactly which share will be the one to find the block, I agree because each individual share has the same chance, but the overall round lengths have to conform to the CDF curve (and they do, there's a graph on slush's pool's website with both the theoretical and experimental curves, which overlap).
PPLNS is heavily penalized though and the likelihood of CherryPicking actually hopping to a PPLNS pool is very small.
Graph of that function