Not always is it something lacking in their diet. One of ours, Ghost, licks everything, from us to the other horses to inanimate objects like the gate. It doesn't matter when or where, even in the middle of winter:
My wife's glove stuck to the gate because it was wet and he licked it without his tongue sticking! I think he has some good antifreeze. We kid about him being part dog.
Some horses have a "fetish" about licking.
Some horses love the taste of rust.