The one thing that's always baffled me about biology is how do Proteins know/perform the tasks their performed for? They're just chains of amino acids, how do they read and correct errors in DNA replication? How do they know where to transport things in a cell? How do they even move?
It's a machine. How do gears know how to transfer energy and capacity for work within a system? How does the train's wheels know how to stay on the tracks?
It just does. Compounds are complimentary, and the universe on our scale can be pretty completely described mechanically. It's just physics.
But those are simple mechanical mechanisms. A trains wheels don't know to stay on the tracks, the tracks just keep the wheels on them. How does the protein that reads and corrects DNA know what to do? How does it know what segments are wrong?
this is the answer basically
We are full of chemical machinery
The point is, it's mechanical in the same way. Now that I'm reading your post again, I realize you weren't asking what I thought you were.
I don't really know the specific mechanics behind it or what affords these compounds the logic to know where to cut, how to unravel these chains, where to place histone groups to allow expression, etc. I think a decent amount is known about dna polymerase, telomerase, and their related pathways, etc. You could start there on your own if no one responds with what you want.
I think "know" is probably the wrong word to use because it invokes teleological and anthropomorphic thinking for (theoretically) reducible chemical processes. At the moment it seems that we don't know, although as you can see in the diagram there is a leading and trailing strand so there is a bit of heads-up if something goes wrong.
Everything a protein does is fundamentally dictated by the basic laws of the universe, e.g. positive and negative charges attracting etc. Proteins are very complex though and their shape is key in terms of their function because their shape lets them fit where they need to fit or lets other molecules fit into them. There is no "knowing" involved, it's just doing the only thing it can do and that's following the basic rules of nature.