How are the requirements of the hash for mining a new block determined? Is it published or a message is sent?
The difficulty calculation is part of the consensus rules that nodes on the network follow. It can be calculated at any time by a node and is calculated every 2016 blocks (two weeks, on average). When the correct number of blocks has passed, the node calculates it based on the last two weeks and adjusts in order to maintain a 10 minute block time (on average). The calculation is in CalculateNextWorkRequired.
Miners can request a block template from a node, in order to start mining, which contains the hash target (i.e. difficulty), see getblocktemplate.