It's better for him to spend 40 years in prison as a hate figure, with all the implications that carries in there, than die at the end of a rope in three weeks' time. It's actually much more of a punishment than more or less instant death after a short period of fear. Plus we withold from the state's (imperfect) legal and incarceration systems the right to perhaps (wrongly) take someone's life away.
I'm sure there'll be plenty of batteries in socks, boiling water, shit in food, shanks, and hands shut in metal doors ahead of him.
I get the desire for revenge, making sure a bully and psychotic sadist thug feels a lot of pain and fear, but humanity should simply have moved beyond the death penalty. Plus everything people have said about actually re-stitching a social care and social work safety net that works for those who need it, not for greedy privateers offshoring profit at the expense of victims who may otherwise have been spared much of the harm.
Sadly whatever systems are in place awful stories of cruelty to children come about with depressing regularity. Child's rights are light years ahead of where they were in the 1970s when children were regularly thrashed for misdemanours at school and no one thought anything of it. No one knows the answer in this country beyond expecting Scandinavian levels of public service for American levels of tax.