Answer: For information on the Norse gods, the Prose Edda of Snorri Sturlson is a good starting point. A public domain translation is available at: The Prose Edda of Snorri Sturlson, translated by Arthur Gilchrist Brodeur .
Loki didn't wager his head against Thor, but against a dwarf called Brokkr. Loki wagered that the value of his 3 gifts:
- the hair of gold for Thor's wife, Sif,
- Skídbladnir (a boat), and
- the spear called Gungnir,
could not be equaled by the dwarf Brokkr's brother Sindri. So Sindri made his own 3:
- a boar with golden bristles,
- a gold ring called Draupnir, and
- a hammer.
The 6 gifts were presented to the Norse gods:
- Thor, and
to judge the most valuable.
The gods judged the hammer to be of the greatest value. Since the hammer was created by Sindri, Loki lost the wager. Loki tried to get away before his head could be severed, but when Thor caught him, Loki was stuck -- but not terminally. Loki had only wagered his head and so he denied his neck.
Brokkr sewed Loki's lips together with a thong called Vartari.