Proof of work: How are target, difficultly and number of leading zeros related to each other I'm aware of this post, this and this one.

I'm a bit confused with the terms. I don't understand how a number of leading zeros, target and difficulty are related to each other. Also, I don't understand how the number of zero's are calculated for the next target.
The target is a number which the hash of a block header must be less than or equal to in order for that block to be considered valid. This target number, when represented as a 256 bit number, has several leading zeros. The actual number of leading zeros is irrelevant and doesn't matter to anything, but us humans talk about the number of leading zeros as a way to understand what mining is doing with the target. It is easier for people to understand that a hash must have some number of leading zeros which is specified by the target than it is for people to understand that the hash is a very large number, and the target is a very large number, and that the hash must be less than the target. Otherwise, the number of leading zeros is irrelevant. The number of leading zeros is based on the target.

The difficulty is also kind of irrelevant. It is just something for us humans to understand how much work is being done to mine blocks. The difficulty is an alternative representation of the target and is just the highest target value possible divided by the current target value.

Of these three things, only the target actually matters. That is what is used to determine if a hash is valid and that is what is changed every 2016 blocks. The number of leading zeros and the difficulty are just different representations of the target to make it easier for people to understand.