If all cells have identical genomes and, therefore, identical transcription factors
Important comment: all cells do indeed have identical genomes, and all cells are therefore equipped with DNA that codes for transcription factors, but that does not mean that all cells have the same state of the genome. It is well understood that different cell types have different chromatin accessibility ('DNA open and closed for enzyme access'), and this is dependent on the modification of histones which DNA is wound around. It is not a complete image to simply visualize DNA as a strand; it is in fact a complicated 3-dimensional structure, and each region or 'neighborhood' of a DNA location is different from other regions. The below image helps in visualizing the levels of ordering. The ordering is very specific based on the current state of the cell and its history (i.e. which progenitors it came from).
Currently, we have a few ways in which we can study DNA conformation and epigenetics (study of things 'on top of DNA') with a few methods, each limited to probing a certain aspect. Among many others, we use:
ChIP-seq and related methods to determine which proteins occupy positions on the DNA (most often we look for polymerases, or histone modifications),
DNase hypersensitivity assays to determine which regions of chromatin are accessible to cutting enzymes, and thus are open for transcription,
3C-based methods to determine which regions of DNA are in close proximity with other regions (via e.g. looping of the DNA strand to bring distal enhancer or silencer elements to promoter regions)
How do cells differentiate into specific types?
Factors that cause differences in morphogenesis are called morphogens. There is an incredible wealth of information on the topic, and it's difficult to find a good place to start. Indeed, transcription factors are central players. The best known family of morphogenic TFs are homeotic genes that are crucial for patterning the body. They give rise to the body plan, determine which cells are the head and which are the opposite end, they determine where organs arise, how segmentation proceeds, and how organs form. The field of evo-devo is the principal field that studies how body morphogenesis is determined at the cellular and molecular levels.
Here is a simplified image that illustrates how the same conserved elements (a handful of Hox genes) determine body patterning even across species:
For the layman, I think there is an outstanding engaging and mandatory video on the topic. It does a good job at summarizing and depicting exactly what you are asking, without going into the painful details that would do the science justice.