How does a tree know to grow its leaves in spring, and shed them in autumn? Does it keep a calendar? How sunny and cloudy it is? Does it remember the previous seasons?
You imagine there might be one instruction that says "grow" and another that says "drop off". As if it were two separate discrete conditions.
But it's even simpler than that. It is actually one system with two ends. It is bimodal.
The tree is monitoring the temperature and sunlight. As it gets warmer and brighter, a chemical says grow. As the weather cools and gets darker, the chemical auxin stops saying grow. It is a temperature-dependent instruction. And other chemical comes in to cut off the leaves and seal it.
It is akin to a sympathetic and parasympathetic pathway in the human body.