During teaching measurement section in the class, Our teacher told us about atomic clocks. I have two questions:
What is exactly an atomic clock?
and how do we synchronize two atomic clocks far far away, e.g. in New York and I Beijing?
The Wikipedia article you cite explains how atomic clocks work, but I have to concede that all such explanations tend to be a bit confusing for the non-nerd. I'll attempt to pick out the main points.
Suppose you generate a microwave signal with a frequency of 9GHz. Then if you want to time 1 second you just count $9 \times 10^9$ cycles of the microwave and that gives you one second. Conversely suppose you want to time something. You start counting the microwave cycles when your event starts and stop counting when it finishes. However many cycles you count, you just divide this by $9 \times 10^9$ and that gives you the time in seconds.
The trouble is that this only works if you are absolutely sure your microwave is exactly 9GHz. An atomic clock uses the fact that caesium atoms absorb energy at exactly 9.192631770GHz. So what you do is shine your microwave beam through a gas of caesium atoms and adjust the frequency until the caesium atoms start absorbing it. Then you know it's frequency is exactly 9.192631770GHz and you can use it as a reliable timer.
This is what atomic clocks do, though as you can imagine the technical details can get extremely complicated. have a look at this NIST article for a good popular level description of how it's done in practice.
Atomic clocks are synchronised with each other by using GPS and sending each other synchronisation signals. In fact about 200 atomic clocks, all synchronised with each other, are used to define International Atomic Time.
Sometimes a molecule's(such as NH3) inversion frequency is so sharp that it can be used as a safe information about time. Sometimes a molecule's vibration is sharp enough sometimes rotation of a tip is sharp enough so you can use that as a primary standard. You must know the temperature and pressure.
You need to know the distance when the sync signal arrives then you calculate from relativistic approach. Also think about the estimated calculation time.