The Red Hat is a Vanity Item equipped in the Helmet Slot. It is dropped by the Clothier when he dies.
The easiest way to kill him is to use the Clothier Voodoo Doll, which allows you to attack him directly.
Otherwise, using traps found underground or in the Dungeon or Jungle Temple, or using Lava will work as well.
If you talk to the Clothier while wearing this hat, he will comment on how it "looks familiar" to him.