How do pathologists tell where a cancer has been migrating from in the body?

Depend on the tissue. Pathologist analyse tissue specimen under microscope using special staining and probes to see cancer cells on tissue. They can only see as much as possible from the specimen given. If they are given specimen of colon and lymph glands- they can see whether cancer has gone to lymph glands. They wont know if cancer has gone to liver. You would need imaging study such as ct scan and pet scan.
Microscope. Pathologists are specially trained to look at the fine details of the cell under the microscope, sometimes using special stains that attach to specific molecules, to determine where it came from. The cells look different from one another and a trained eye can tell them apart.