To modern eyes trial by ordeal sounds barbaric and crazy, but it actually works, to a degree. Well, it's not a measure of God's will, but if you believe that it is; then it works.

This is more than a placebo effect (where expectation of improvement due to a treatment improves perception of symptoms).

With trial by ordeal, if you are guilty and expect punishment, then you will be particularly stressed. If you are stressed, it has recently been realised that your body releases corticosteroids that has several effects, which includes delaying healing... On the other hand if you have a clear conscience, then you will be relaxed and your body will deal with the injury far more readily.

Similarly, if you are licking a red hot surface, and you are nervous because you actually did the crime, then you will have a dry mouth. In that case, the tongue will tend to burn. Otherwise, steam acts as a pretty decent insulator as anyone who has put a wet finger on a hot iron can tell you.

In some cultures trial by ordeal has been approached using the Calabar Bean. This is a bean that contains a painless poison. A preparation is made of the bean and fed to the prisoner. If the prisoner vomits within half an hour then they are set free. Otherwise, they die. The trick is that the response of the prisoner is modified by stress; a highly stressed, worried, guilty person has a much more acidic stomach and this releases the poison more quickly, which will inhibit the vomit reflex and permit the poisoning to go to completion.

Of course all this stuff falls down if you are sociopathic. In that case, you've done wrong, but you just don't care. You'll deal with the ordeal just fine. Hey, no legal system is perfect ;-)