Tim

Tim is a Caster skeleton found in the Cavern. 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 the Cavern layer. Its chance to spawn is very low (27 out of 28000) and random, and cannot spawn in water. You can increase the rate at which monsters spawn with a Water Candle and/or Battle Potion, and thus be able to find him faster as long as other monsters don't prevent him from spawning due to the spawn cap. You can be sure he has spawned if Chaos Balls randomly head your way.

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

At an early stage of the game he may seem very hard but if you manage to defeat him the wizard hat will be helpful las it gives some defense and more stats to magic damage.

If encountered at a later stage of the game and is un reachable dodge his magic attacks (if needed) and wait for him to teleport. Then attack him.

If you are using a ranged weapon such as the Minishark or Clockwork Assault Rifle aim at the mid section of his body as that's where he shoots and it will destroy his projectile so it doesn't come at you.

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.

History
Tim Tim Tim Тим