How do nodes come to a consensus on difficulty?
There is no coordination done specifically for difficulty calculations. The difficulty is computed deterministically based on the data in the blockchain (shared among all nodes), specifically the timestamps of blocks.