Here is a simple explainer on how HERP and DERP works.
HERP is ckpool.org's equivalent of conventional PPLNS's "last N shares." HERP exists on two levels: at the pool level and at the individual level.
At the pool level, HERP is the pool's total tally of miners' shares at any given point in time. All shares are weighted by their respective difficulty values. In other words, a share with a higher difficulty value occupies a greater proportion of the pool's tally of shares compared to a share with a lower difficulty value. In contrast, conventional PPLNS does not take into account the difficulty value of each share.
At the individual level, HERP is your own tally of difficulty-weighted shares within the pool's total tally.
The N value used by ckpool.org is
5 x (the current Bitcoin network difficulty value). For example, the Bitcoin network's difficulty value currently stands at 4,143,878,474,754.19 as of block
522147. Therefore, ckpool.org will keep a rolling tally of up to 20,719,392,373,770.95 difficulty-weighted shares. When the pool's tally of difficulty-weighted shares reaches that limit, new shares will constantly replace the oldest shares to keep the total tally at 20,719,392,373,770.95 difficulty-weighted shares.
DERP is the proportion of your individual-level HERP compared to the pool-level HERP, and this is what determines your actual payout amount. Your DERP value may be found by dividing your individual-level HERP by the pool-level HERP.
In other words, your DERP is determined by how many of those 20,719,392,373,770.95 difficulty-weighted shares belong to you. The greater the proportion of individual-level HERP you have out of the pool-level HERP, the greater your payout amount will be. For example, if at this point in time, you have accumulated your own individual-level HERP of 21,000,000,000, then your DERP would be
21,000,000,000 / 20,719,392,373,770.95 = 0.00101354.
You are paid only at the exact moment the pool finds a block, with your payout amount being your DERP at that particular moment in time.
I hope this helps to clear up some of the confusion regarding HERP and DERP.