Because of fear and political expediency.
Basically, the abuses of power described in the question boil down to propaganda on the part of the Ministry of Magic. Political concerns in each case took precedent over the legal concerns of due process. Because so much power lies in the hands of largely unaccountable politicians in Harry Potter decisions end up being made in the court of public opinion. Basically, the Ministry cared more about keeping the public happy than they did about having a fair legal system.
In the case of Hagrid, Fudge's concern is clearly how his actions will be viewed by the wider wizarding community.
“Look, Albus,” said Fudge, uncomfortably. “Hagrid’s record’s against him. Ministry’s got to do something - the school governors have been in touch -”
“Yet again, Cornelius, I tell you that taking Hagrid away will not help in the slightest,” said Dumbledore. His blue eyes were full of a fire Harry had never seen before.
“Look at it from my point of view,” said Fudge, fidgeting with his bowler. “I’m under a lot of pressure. Got to be seen to be doing something. If it turns out it wasn’t Hagrid, he’ll be back and no more said. But I’ve got to take him. Got to."
(Chamber of Secrets, Chapter 14, Cornelius Fudge).
In short, he cares more about being seen to do the right thing than he does about actually doing the right thing. Justice is secondary to the political damage keeping Hagrid out of jail could do to his reputation.
The same PR game is afoot with Stan Shunpike.
“They’re not still holding Stan Shunpike, are they?” asked Harry.
“I’m afraid so,” said Mr. Weasley. “I know Dumbledore’s tried appealing directly to Scrimgeour about Stan...I mean, anybody who has actually interviewed him agrees that he’s about as much a Death Eater as this satsuma...but the top levels want to look as though they’re making some progress, and ‘three arrests’ sounds better than ‘three mistaken arrests and releases’...but again, this is all top secret...”
(Half-Blood Prince, Chapter 16, A Very Frosty Christmas).
Scrimgeour is quite brazen in admitting to Harry that the public's perception of events matters more than the truth (when discussing the media claims that Harry was the Chosen One).
“Well, of course, to you it will matter enormously,” said Scrimgeour with a laugh. “But to the Wizarding community at large ... it’s all perception, isn’t it? It’s what people believe that’s important."
(Half-Blood Prince, Chapter 16, A Very Frosty Christmas).
If manipulating the legal system for political reasons seems rather extreme, bear in mind that (during the wizarding wars, at least) people were terrified of the Dark Arts. Fear pushed the wizarding community into permitting harsher and harsher punishments against suspected perpetrators. That fear gave Barty Crouch the powers he had and resulted in Sirius being denied a trial.
"You’re scared for yourself, and your family, and your friends. Every week, news comes of more deaths, more disappearances, more torturing...the Ministry of Magic’s in disarray, they don’t know what to do, they’re trying to keep everything hidden from the Muggles, but meanwhile, Muggles are dying too. Terror everywhere...panic...confusion...that’s how it used to be.
“Well, times like that bring out the best in some people and the worst in others. Crouch’s principles might’ve been good in the beginning - I wouldn’t know. He rose quickly through the Ministry, and he started ordering very harsh measures against Voldemort’s supporters. The Aurors were given new powers - powers to kill rather than capture, for instance. And I wasn’t the only one who was handed straight to the dementors without trial. Crouch fought violence with violence, and authorized the use of the Unforgivable Curses against suspects. I would say he became as ruthless and cruel as many on the Dark Side. He had his supporters, mind you — plenty of people thought he was going about things the right way, and there were a lot of witches and wizards clamoring for him to take over as Minister of Magic.
(Goblet of Fire, Chapter 27, Padfoot Returns).
The fact that Barty Crouch was permitted to gain as much power as he did, and indeed gained enough political capital to be considered Minister of Magic material, shows that there are very few checks and balances in the wizarding world. Fear was the reason for the accumulation of greater powers with Crouch, and fear serves as the backdrop for the premierships of Fudge and Scrimgeour. People probably cut them more slack than they might've done before Voldemort rose to power.
It's worth noting, by the way, that there is something of a legal system in Harry Potter. The Wizengamot has certain laws which gives defendants some legal rights. It may not add up to much but it is better than nothing.
"I may be wrong," said Dumbledore pleasantly, "but I am sure that under the Wizengamot Charter of Rights, the accused has the right to present witnesses for his or her case? Isn't that the policy of the Department of Magical Law Enforcement, Madam Bones?" he continued, addressing the witch in the monocle.
"True," said Madam Bones. "Perfectly true."
(Order of the Phoenix, Chapter 8, The Hearing).
I suppose the wider question is: why did the wizarding world grant so much power to their politicians and civil servants in the first place? Why were the civil rights that did exist not stronger? Why were there not more dissenting voices.
You have to remember that the wizarding world is an ancient society. Many of its laws are medieval and have not been changed for years. This is a culture in which centaurs, goblins and other magical creatures are marginalised, werewolves are exiled and house-elves are enslaved. Any legal system has been in place for many years and change is not the norm. Occasionally, new laws are written, like Arthur Weasley's Muggle Protection Act or the numerous Educational Decrees. However, if the wizarding legal system seems to deny people basic civic rights then that can probably be put down to it being, by and large, an unmovable object.
Civil change often comes about as the result of widespread activism. This sort of populist dissent is not really a feature of the wizarding world. The only campaigning we see in the series is Hermione working on S.P.E.W. Her efforts draw little but scorn.
Some people, like Neville, had paid up just to stop Hermione from glowering at them. A few seemed mildly interested in what she had to say, but were reluctant to take a more active role in campaigning. Many regarded the whole thing as a joke.
(Goblet of Fire, Chapter 15, Beauxbatons and Durmstrang).
I think that people were not only willing to support Hermione's campaign but indeed viewed the whole idea of campaigning at all as a weird pursuit. I think they simply didn't understand what she was doing because no equivalent to political campaigning existed in the wizarding world. Witches and wizards are generally seen to be very deferential of political authority figures and seem to 'know their place'. Cornelius Fudge was admittedly driven out of office because of a public outcry, which shows that power isn't absolute. There is little evidence of any attempt to secure legal rights through political activism, though. That meant that the victims of political stitch-ups were left without a voice, leaving the cycle of abuse to continue.