How do nodes come to a consensus on difficulty? Specifically I would like to know what messages are sent between nodes in order to figure out total processing power of the network and therefore difficulty. How is the new difficulty value spread through the network and what if nodes do not agree on it?
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.