Reabsorption in the proximal convoluted tubuleWatch
I don't think that "our body" OR indeed any organ can be said to "know" anything in the same way that our brains allow us to know certain facts about life or about A level biology OR when we know that e.g. it was freezing last night because the cold receptors in the skin send nerve impulses to the CNS, which eventually reach the sensory cortex in the paracentral gyrus of the frontal lobe where we detect any sensation.
There are, however, extremely complex and intricate mechanisms that control the levels of various substances in our body e.g. glucose, electrolytes, amino acids, hormones, etc.
A. In normality, all glucose is reabsorbed in the proximal convoluted tubule by active transport using mechanisms such as the SGLT family (sodium-glucose transporters), which allow co-transport of glucose together with Na+ ions. Now, Na+ levels in the body are controlled precisely within the normal reference range of 135-150 mmoles/L [at least at the hospital where I trained] mainly by the renin-angiotensin-aldosterone axis, in which higher levels of renin promote greater reabsorption [in the proximal tubule] of Na+ in exchange for K+. You will ask "But what determines the level of renin?" OK good Q - a number of things, not least the blood pressure, which is an index of Na+ [and therefore of water by osmosis] retention in the body [via the magnitude of venous return to the right heart which determines how much force the heart beats with by the Frank-Starling Law]. If the blood pressure is low for a finite period, greater renin secretion occurs from the juxta-glomerular cells, hence increasing Na+ reabsorption, and tending to mediate recovery from the drop in blood pressure [and vice versa].
B. The level of glucose in the blood (should not exceed 6 mmoles/L) is also very precisely controlled, in this case mainly by the hormones insulin & glucagon [although growth hormone, adrenaline and the steroid hormones also have an anti-insulin effect], which reduce and increase blood glucose levels, respectively, as required. One mechanism by which serum glucose level can be e.g. reduced, is by less reabsorption in the proximal convoluted tubule, which is one of the several mechanisms used by insulin to correct hyperglycaemia (hyper = high) [patients with diabetes mellitus can pass urine containing glucose [a finding referred to as glycosuria], which can raise suspicion of diabetes, if it has not already been diagnosed].
There are mechanisms that control the reabsorption of amino acids, too [depending on the chemistry of the particular a.a.] If this goes wrong, the patient will suffer from amino-aciduria [if curious, google "Hartnup disease", in which there is histidinuria].
Hope this helps! Just be careful that you do not attempt to absorb all the above; some medical students may not know all this - dw if you find it difficult to grasp some parts if you are doing A level biology, although I teach more detail than in the syllabus to my own students because if you know more than you need to, then what you do need becomes a "trifle" (yummy!! ).