In the US, everyone has the right to a trial, in theory. However, if every defendant, or even a significant minority of them demanded their trial, the system would collapse.
To solve this problem. Prosecutors (lawyers working for the government) are given extraordinary power. They use their ability to charge any defendant with inflated charges that carry long jail sentences, then offer to reduce the charges if the defendant gives up their right to fight. Despite being obviously coercive and prone to force innocent people to confess, it’s perfectly normal, legal, and necessary to the US criminal system.
A lot of the time it’s obvious who did it.
The court proceedings is about how harsh they sentence the accused, not finding out if they did it.
If they confess and show regret they may get a less harsh sentence.