It’s pretty simple.
Prune deletes all revisions except keeping some if there is a matching keep rule
Rules are checked left to right and first matching is used. That’s why you have to sort them.
-keep 123:456 will match specific revision being tested if it is older than 456 days. The effect of this rule will be deletion of all revisions older than 456 days, except keeping one every 123 days.
If any specific revision is newer than 456 days — this specific keep rule won’t affect it and the next keep rule will be tested. If no keep rules march - nothing is done.
That’s it. Pretty straightforward, no magic.