Morphology is still largely an unexplored area when it comes down to the nitty-gritty of exactly how genetics determine the overall form of large-scale organs and structures like bones. That is, your femur and your skull are both made of the same stuff, more or less, and yet they initially form and then maintain completely different shapes. How?
Answers are going to be necessarily vague at this point in our understanding, but the short answer is that it probably works somewhat like a colony of bees. Worker bees aren’t clones, but they have very similar genetic makeup because of the way that bees reproduce. So while they don’t share truly identical DNA like the individual cells in your body (presumably) do, for practical intents and purposes, a worker bee is a worker bee is a worker bee. And yet, individual worker bees can take on a wide variety of distinct jobs within the colony – guards, caretakers, pollen gatherers, carpenters, etc. The same worker bee may even change roles in response to the hive’s current needs and environmental conditions. But this isn’t because the worker bee is smart enough to analyze something as complex as a bee hive in order to chose what it needs to do. Rather, its behavior is determined by chemical interactions and signals. Worker bees performing particular tasks release specific pheromones associated with that task. Worker bees organize simply by smell. Exposure to different levels of the various pheromones prompts behavioral changes via chemical action (or lack thereof) on neural pathways. So if, say, a large number of “nurse” bees die, the drop in that pheromone level may cause other worker bees to switch tasks and become nurse bees. As they do, they start releasing the associated pheromone(s), which brings the system back into equilibrium once enough workers have switched over.
Ok, so that’s a bit of a digression, but the situation with your own cells is similar. You cells obviously lack the facility for “thought” as we usually mean it, but they are in some sense aware of their surroundings. Cells exchange various chemical compounds with adjacent cells, and in some cases with distant cells via chemicals carried in the blood supply. These chemicals affect the organelles within the cell, which in turn affects RNA transcription, protein formation, and other cellular activities purely through chemical reactions. Alterations to a cell’s behavior can affect the chemicals that it produces and exchanges with neighboring cells and with the circulatory system, thus possibly altering their behavior, too. It’s similar to how one worker bee dying can cause another worker bee somewhere else in the hive to change jobs. It’s not that the other bee actually “knows” the first bee died, it’s just reacting to chemical changes in its own local environment.
Because there are so many chemical interactions to study, we just don’t know enough about them to give a really solid answer to your question. We do understand some of these interactions, but the ones we understand are only a tiny fraction of the whole. What’s more, the affect of two chemical signals in conjunction may different than the affect of either chemical signal alone, and the affect may be different depending on the current chemical state of the cell, or on externally influenced factors like temperature, or the amount of oxygen in the blood. As you can imagine, the situation is enormously complex. Hopefully the hive analogy gives you some idea of how this works, though.