>>> I often wonder how lengths of sentence are calculated
All of the guidelines that judges have to work to are in the public domain. (Judges are obliged to stick to the guidelines other than in really exceptional circumstances, when they must explain why they've deviated from those guidelines in open court).
For example, the woman in the case to you refer to was originally arrested for GBH with intent. Had she actually faced that charge in court, these guidelines would have applied:
https://www.sentencingcouncil.org.uk/offences/crown-court/item/causing-grievous-bodily-harm-with-intent-to-do-grievous-bodily-harm-wounding-with-intent-to-do-gbh/
However she was eventually only charged with ABH, meaning that it was these guidelines that the judge had to work to:
https://www.sentencingcouncil.org.uk/offences/magistrates-court/item/assault-occasioning-actual-bodily-harm-racially-religiously-aggravated-abh/
(Note that the maximum penalty allowed by law for ABH is 5 year's imprisonment but the guidelines only allow an actual maximum sentence of 3 years. Further, a judge must reduce a sentence by one third for an early guilty plea, reducing the maximum down to 2 years).
I didn't watch the programme but I've been reading this:
https://www.digitalspy.com/tv/a36103891/24-hours-in-police-custody-tragic-male-domestic-violence-case/
As I see it, there was no hope whatsoever of the woman being found guilty of either murder or manslaughter, as the was no evidence (meeting the 'reasonable' doubt test) to show that her actions led to the man's death.
So that would leave the Crown Prosecution Service wanting to pursue a 'GBH with intent' charge. However they will have been aware that the victim's statement saying that he'd fallen while drunk and hit his head (which could no longer be challenged after his death) might have led to a jury deciding that there was sufficient doubt in the CPS's case to acquit the defendant, allowing her to get off scot-free.
Thus a 'GBH with intent' charge would have been risky both for the CPS and for the defendant. Facing such a charge, she'd have been risking a hefty sentence, while the CPS would have been risking losing the case altogether.
So the CPS has almost certainly approached the defendant's barrister and said "If your client will agree to plead guilty to it, we'll drop the charge to ABH". By doing so they'll have ensured that the defendant received a prison sentence, even if it's a lot shorter than one for 'GBH with intent' would have been, rather than risking seeing her being acquitted altogether.