Horizon isn't a double entry book keeping system, it's more of a transactions register, which also enables a range of post office products. Clearly all transactions should balance out but there wasn't the granularity of transaction data available to PO Limited or the subpostmasters to go through this. The support contract with Fujitsu only allowed a limited number of ARQ (log data) per month so this was rarely investigated. One lady who worked at Westcliffe took a list of her own transactions and was able to clear herself in court by sowing more than a little doubt with the jurors, by simply going through her list and comparing with what POL was saying. She was still fired by POL despite being found not guilty, and her replacement threatened with dismissal if she gave evidence that she too was finding shortages.
I know the answer to the second paragraph quoted. In a "normal" year, around 5 or so SPMs are convicted of theft or fraud. This went up to 50 plus during the period from 2008 to 2013. In 2014 a barrister wrote the Clarke's Advice, the smoking gun, telling POL of the risk of miscarriage of justice. POL still prosecuted 30 or so people after the Clarke's Advice, and until fairly were drawing on bankruptcy trustees to recover "losses". Lee Castleton, the Bridlington SPM shown in the ITV drama is still under a bankruptcy trustee to this day. SPMs were hand-picked to be honest workers, so I'm now unsure if even the 5 a year can be relied upon.
Separately The Observer today has a leak from the Justice Department to the effect that private prosecutions are under some sort of review by HMG. The Labour party is also looking at this. The HMG version is new prosecution standards, an inspection process and the power to remove prosecution rights.
Surpluses - small ones - did and will happen. But the repeating "losses" was a unique feature of Horizon's operations. Crown Post Offices, so not SPMs, also saw discrepancies in multiple directions, but were not usually prosecuted. Some SPMs did not usually get shortfalls, or they were very small - there were different Horizon configurations and implementations. Some SPMs noticed problems with Chip and Pin, which was bolted on after initial implementation, others had issues with National Lottery transactions - not all SPMs did National Lottery. The staff at Crown Post Offices do feature in the 2000 or so who have claimed compensation - some were fired, others were moved to other roles, losing salary and promotion options in the process. A few Crown staff were prosecuted though.