Mimir was the wisest god of the Aesir and one of the two gods sent as hostages to the Vanir. After the Vanir discovered they had been tricked by the Aesir, they hacked off Mimir's head and send it back to the Aesir.
Odin took the head, smeared it with a mixture of herbs, so that it would never decay, and placed powerful spells on it. The forces Odin called upon were so great that not only the head was brought back to life, but it was also able to speak to him. From that moment on he regularly consulted the head which revealed many occult secrets to him.
See Also: Kvasir