Can anyone explain the reasoning behind this post? I am reading THIS blog post,
and I do not understand the logic behind this part: 



Why is the relu here max(0, Xavg - X) ? And even so, it does not really explain the values obtained in the two situations where X1 = X2 = 0, X1 = 1 and X2 = 0, and X1 = X2 = 1.

Can someone please explain this in more detail?
"Weight of $-4$" seems to be the key thing you're missing.  Translating a little, the neuron's value is $\operatorname{relu}(5-4x_1-4x_2)$.

Oh, and there seems to be a typo in the post:
"Then, if X2 also gets switched to 0" should be "switched to 1"