Where and when did the custom of wearing ties start? When were they deemed important in social circles? What a pain in the ass they are.
-- Bob, the net
We traditionally blame the French for ridiculous fashion traditions, and this one's no different. Except it wasn't their original idea. They borrowed it from regiments of Croatians who came to Paris to support Louis XIV and defend the wobbly French aristocratic system. Instead of starched lace collars, the Croat militia wore scarves wound around their necks and tied in front. The idea took Paris by storm. Well, the rich and fashionable part of Paris anyway. Anything military was all the fashion rage, so colorful neck scarves became mandatory for the French court. There was even an elite French military regiment called the Cravate Royale (the Royal Necktie) that sported the hot new accessory.
Clothes are basically costumes. Always have been. They say who you are (or who you'd like people to think you are) and where you fit in society. So what better than to take your fashion tips from the upper classes. The royal French neck scarf gradually spread in popularity around Europe and took on various local forms. The lavish and colorful puffy neckties trimmed in lace and embroidery generally were reserved for the upper classes, but the average guy adopted his own more practical version, more like a bandana. It could be used to mop your brow or removed to carry fruit home from market.
Neckwear and men's clothing for the upper classes was frilly and poofy and generally out of control through the 17th ad 18th centuries, with elaborate neckwear one of the features. Everyone tried to outdo the next guy with silk and laces and ribbons. But comes along a Brit, Beau Brummell, an arbiter of men's fashion in the 1800s, who proceeds to point out that the emperor perhaps has too many clothes. He advocated a plain and tailored style for the upper-class gent, with a dark jacket, pale pants, and a greatly reduced necktie in pristine white tied with one of any number of distinctive knots. From this point on, through the Industrial Revolution, men's fashion took on a much less flamboyant tinge. Kings and emperors no longer set fashion trends. But the necktie, in much reduced form, hung in there, still the accessory of choice for a businessman or someone in a slightly elevated social position. It started out as a personal identifier and by the end of the 19th Century it was taken perhaps to its ultimate form. Men could buy ties that bore designs that identified them as members of a particular club or school, military unit, or other social group. This was about the time that collared shirts became popular and ties assumed their now common form.
Why men have dumped wigs and high-heeled shoes but still kept the dreaded necktie is a trickier question. If you look at dress as costume and self-identifier, ties have always said "I'm important," "I'm serious," "I graduated from this prestigious school," "You can trust me." As part of a man's business uniform, it's pretty much mandatory. Maybe in some circles you could get away with a Rolex watch and no tie, but until some generally accepted high-credibility accessory comes along, the necktie is here to stay.