A series of three consecutive successes, in sport or some other area of activity.
The sports pages of UK newspapers have been full of hat tricks recently (2010), as there has been a spate of them at the start of the Premiership Football season. Didier Drogba, playing for Chelsea, narrowly missed out on being the first Premiership player to score a hat trick of hat tricks, that is, three goals in each of three consecutive games. Those reports refer to players 'scoring a hat trick', but the first hat tricks weren't scored, they were 'taken'.
So, where does the term 'hat trick' come from? The first sport to be associated with the term was cricket. From the 1870s onward, 'hat tricks' are mentioned in cricketing literature; for example, this piece from James Lillywhite's Cricketers' Annual 1877:
Having on one occasion taken six wickets in seven balls, thus performing the hat-trick successfully.
While that doesn't define what a hat trick is exactly, the arithmeticians amongst you will have noticed that, to take six wickets in seven balls, a bowler has to take at least three consecutive wickets.
The theory goes - and there aren't sufficient records to be precise about this - that if a bowler dismissed three batsmen in a row, a collection was taken and the proceeds were used to buy him a new hat. Either that, or a hat was passed round and the bowler trousered the proceeds. That explains 'hat', but why 'trick' exactly? The feat is difficult and is quite a rarity in cricket, there having been only 37 hat tricks in Test cricket history, but 'trick' doesn't seem the obvious word for it. What may well have influenced the choice of words was the sudden popularity of stage conjurers' 'Hat Tricks', which immediately preceded the first use of the term on the cricket field.
The magician's Hat Trick, where items, typically rabbits, bunches of flowers, streams of flags etc., are pulled out of a top hat, is well-known to us now but was a novelty in the 1860s. It isn't known who invented the trick. The first reference that I can find to it in print is from Punch magazine, 1858:
Professor Willjabber Derby's Clever Hat-Trick. Wiljada Freckel was a clever German conjuror, who produced an infinity of objects from a hat.
The trick is accomplished by either using a top hat with a false lid or by sleight of hand. It became something of a fad in Victorian England and, while 'hat trick' wasn't seen in print before 1858, the term appears many times in newspapers throughout the rest of the 19th century.
When cricketers in the 1870s wanted to give a name to an impressive achievement that involved a hat, what more obvious name than the currently pervading expression 'hat trick'?
The term was also appropriated from the variety stage for the political stage, where Victorian MPs were said to have 'done a hat trick' whenever they reserved their seat in the House of Commons by leaving their top hat on it.