Tim

Tim is a Caster skeleton found in the Underground. He can be recognized by his Wizard Hat. Just like any other caster, he will randomly teleport himself to a visible part of the screen after shooting three Chaos Balls. Defeating Tim is the only way to obtain the Wizard Hat.

Tim is immune to the Poisoned debuff.

Finding Tim
Tim can be found anywhere in Underground and Caverns layers. Its spawn rate is very low and completely random, but it seems to increase with Depth - it is more likely to find him closer to the Underworld. You can also increase his spawn chance with a Water Candle and/or Battle Potion.

Fighting Tim
Tim is a spellcasting enemy that shares great similarities with the Fire Imp and, when fighting, should be treated like one. Tim can cast spells that go through blocks, however his attacks can be deflected by attacking them with your weapon (ranging from Tools to Weapons). He fires three shots, waits a bit and teleports to anywhere on your current screen. And by having the same AI of the Fire Imp, when hit, he will wait a bit, and then teleport away. Attack him before that happens.

Trivia

 * His name is a reference to Tim the Enchanter from Monty Python and the Holy Grail, as confirmed by Blue on the Terraria IRC.
 * Tim looks exactly like a Dark Caster, except that he is wearing a Wizard Hat.
 * His clothing resembles the Robe vanity item.
 * Though all rare enemies spawn rates are low, Tim's seems to be the lowest, with a roughly 5% chance to spawn.

History
Tim Tim Tim Тим