How does a cell identify itself?
This has been studied this in Drosophila, and a lot of development hinges on where the cell is in the body.  An initial asymmetry of mRNA in the pre-fertilized ovum leads to the establishment of the anterior-posterior axis (which end is the head, which is the tail)  So cells are told what to develop into based on what mRNA signals they receive which depends on where they are along that axis.

https://en.wikipedia.org/wiki/Drosophila_embryogenesis