Horses Eating Wood and Trees

Why do some horses eat wood fences and barns, destroy trees for the consumption of bark, gobble up dirt, feast upon feces of other horses, lap at urine puddles or prefer one bale of hay and not another?