Your human system, comprising your senses, your brain, your nervous system, your muscles, everything that is 'you', contains two processing systems which work in balance. One is always late, and one is always wrong.
Living organisms are physically build as 'servomechanisms', comprising one or more actuators which can produce an output or action, and one or more sensors, which regulate the output in order to achieve a target state.
A home heating system is a simple example of such a servomechanism. You can set the target room temperature on the thermostat and the system will then regulate itself to maintain that target state.
Imagine a flower. It opens its petals in the morning, and closes them in the evening. How does it 'know' when the sun is out?
The simple answer is that it has cells which respond to light, warmth and air humidity, which create physical changes in the flower, which cause its petals to open or close. Some flowers even seem to 'follow' the path of the sun. Perhaps you've seen time lapse nature documentaries which show this in action.
The flower, or a frog, or a worm, or an ant, is entirely reactive to its environment. These organisms seem to have some awareness of their environment, but it's hard to imagine that they have free will or consciousness in the way that we experience it. However, we tend to project the concept of a mind onto such creatures. We might say that an ant 'wants' to go somewhere, or that the worm 'doesn't like' bright sunlight. Our ability to imagine what other people are thinking doesn't stop with other humans, we imagine that all kinds of creatures have minds, with intentions and objectives, likes and dislikes.
As 'higher' animals evolved, the need for these purely reactive control systems became a limitation. Reacting to the environment is useful, but our reactions are always late. If a predator can react faster than we can, our survival chances are greatly reduced.
What many animals have evolved is a prediction system which can learn from past reactions and identify what could be about to happen, and react ahead of time. We live in a universe of cause and effect. Everything that we can observe and experience is preceded by something else. Rain falls for a reason. When we feel the change in the direction of the wind, and we see the dark clouds forming, we know rain is coming. When we see the buds forming on the trees, we know spring is coming.
If we were to slice your brain in half, we would see 6 distinct layers. At the bottom, we have the brain stem, the most 'ancient' part of your brain in evolutionary terms. This is where basic functions such as breathing, heartbeat, temperature regulation and so on take place. At the top, we have the neocortex, the wiggly outside bit that you've seen many times in photographs.
When a new sensory stimulus arrives, the neurons in your brain pass the incoming signal all the way up to the top level where that signal is processed to create a motor output. You experience something new, figure out what to do about it, and finally you take action.
This process is adaptive and innovative, but it's slow, and it requires a lot of brain power. You could not respond to every stimulus in the world around you by figuring out what to do each time. You must learn to respond automatically, so that when you're driving and you see a traffic light change from green to red, you stop the car without having to think about it.
Thanks to the magic of Spike Timing Dependent Plasticity, discovered through the 1970s and 1980s based on the original work of Donald Hebb in 1949, neurons that are close to each other in the brain will spontaneously connect together when they are activated in a particular sequence and within a particular time window. When one fires just before the other, they connect together and create a 'short cut' which now speeds up the overall connection.
As the input and output signals pass by each other in the brain, the neurons that connect the signals begin to connect together, all by themselves.
As the stimulus and response are repeated, through practice, or through repeated exposure to the stimulus, or through the action of the hippocampus in replaying unusual events, the cross connections reach down into the 'lower' parts of the brain.
Finally, the cross connections exist all the way up through the layers of the brain and the response has now become a physically hard wired connection; fast, but fixed.
You can see the two systems at work here. The reaction system is always late, because the system takes time to react to the stimulus. The process of hard wiring the response reduces that delay, but there's always a delay. The prediction system builds on the reaction system by cross connecting preceding stimuli, events which usually come before the one we're responding to. For example, the first time you hear your boss yelling at you, you feel bad. The more your boss yells at you, the better you get at picking up signs of your boss coming into the office. Your brain connects their voice tone, the sound of their footsteps and other cues so that you can preempt what's about to happen. The problem is, the sound of footsteps isn't what causes your boss to yell at you. Your prediction system is excellent at predicting physical events, such as the motion of a snowball as it flies towards your face, but very bad at predicting external events where another person's free will is involved.
We can predict changes in the weather, or the flight path of a snowball, with a high degree of accuracy, and from this we form the idea of being 'right'. We learn, by constantly shifting our awareness forwards in time, that when a cause occurs, its associated effect will follow. However, this leads to a cautious attitude to events. It's better to be safe than sorry, and the predictive system is self-confirming and self-reinforcing. The simplest way to avoid being wrong is to keep quiet, so we avoid the risk of testing our predictions. Our brain reinforces the instances when we're right, and we become more sure of our predictions.
By predicting the response of your boss, you begin to act as if you're already in trouble, which signals to your boss that you've done something wrong. You actually create the response that you're trying to avoid.
Your reaction system is always late.
Your prediction system is always wrong.
By balancing the two, you're able to navigate the complex, ever-changing world that we live in.