Back in the olden days, when I was at school, detention was quite a rare punishment and only given for bad behaviour like fighting, swearing, etc. It was the same when my DDs were at school.
My 12 year old DGD now attends the same secondary school where her mum and aunt were pupils. Detention is handed out all the time for what I would consider to be pretty small stuff, such as forgetting a piece of PE kit or being 5 minutes late. Things which teachers used to deal with by giving the offender a sharp telling-off. Doesn't a punishment lose its impact if there is no difference between the consequences for inadvertent mistakes and deliberate bad behaviour?
My DGD worries about getting detention and has managed, so far, to only be detained once. This was for forgetting to hand in a piece of homework. Again, wouldn't a telling-off have done the job? She was very upset and ashamed to be in detention. Her former friend - no longer in the same class, thank God - gets detention several times a week for being rude, disruptive in class, skipping lessons, etc. She couldn't care less and it has absolutely no effect on her behaviour. If, for example, the punishment for insulting a teacher is the same as for forgetting a library book, how is it supposed to be a deterrent? The good kids are cowed and the naughty ones know that they might as well be hanged for a sheep as for a lamb.
As for schools which give detention for not sitting up straight, not facing the front, etc... You send your kids to school to learn, not to join a chain-gang. And detention for getting less than 100%? Why should you be punished for something that you couldn't do, as long as you tried? I don't think I could have got 100% in algebra if you had held a gun to my head. I would have been in detention all the time.