If you were accused of a crime, you either confessed or were subjected to a test such as drowning. This was the judicial method of determining innocence or guilt - truth or falsehood - before there were judges, juries, and evidence.
In trial by ordeal, the expectation - or pretense - was that God would intervene in the outcome if the accused were innocent. The most common test was ordeal by hot water, in which the accused had to reach into a pot of perhaps boiling water and retrieve an object. It was up to the priest to determine how hot the water was, so the verdict could be a forgone conclusion. (You know the expression “in hot water”.)
In the ordeal by hot iron, the accused person would carry a burning hot iron so many paces without being burned to prove their innocence. Again the priest could rig the outcome. Alternatively, there was trial by fire - a familiar expression. This required the accused to walk a certain distance over red-hot plowshares (metal blades).
In ordeal by cold water if the person were innocent they would sink, and if they were guilty they would float - that’s not the wrong way round. If the priest considered you innocent, you might be instructed to struggle in order to ensure sinking. The sinking individual was not left to drown (which would have made it a “heads you're guilty, tails you're dead” test).
Of course, there were other ordeals that were as sadistic as they sound, such as by cross (actually not crucifixion), by burning oil, and by poison.
Monty Python: “How do you know she is a witch?”