The question "how is this explained legally" is worth answering.
Its not the same as "how does guilty/not guilty work", or even the "not proven" verdict in Scottish law.
The idea here is that a prosecution pits an Individual against the full power of the State. A state can easily abuse that power, and many states routinely do so today. Most of the rest, even if they do mostly follow rule of law now, did in the past, and can at times abuse at present.
For example, if there were no rules, we might be less sure evidence was reliable. A person accused, or even found innocent, could be constantly at fear of a second, third, or tenth inquiry/prosecution. Obviously the state doesn't live in fear for years or ever, but individuals can and do.
So in criminal law theory, a number of rules exist that specifically address this imbalance and aim to reduce the incentive for abusing power. Some of those rules are behind the answers to your question.
A main idea in UK/US law, is that the state, with all its power, gets just "one bite at the cherry". If they think a person did something, they have to prove it, and if they can't totally convince a jury then they don't (usually) get a second chance.
That's the idea behind so called "double jeopardy" laws, that generally you can't be tried again for a crime if acquitted. The state can wait and avoid a case until they are sure they have enough to prove it, but they need to be sure they have that strong a case, because they won't get a second chance if they fail. You can see how that can work as an incentive for careful work, as well as preventing many kinds of abuse.
A second idea is that a person is usually considered innocent unless and until proven guilty. That means, if the state, with all its power, could not totally convince a jury they did the stated crime, then the public at large should not assume they did it, either. Even if they did do it, if the state couldn't convince a jury then that is a big red flag that society at large shouldn't assume they did.
Being accused as a criminal is a heavy burden, for life, so if it isn't clear, its usually seen as better to play safe and not ruin someone's life, even if there is a chance they did it.
In a realistic view of the world, there is always a chance that some will be punished who didn't do a crime, or some will be let off who did do one. You don't get to avoid these, because you dont have perfect knowledge. You only get to choose which kind of error is more important to try and minimise.