The solution “because they simply do” might be your initial response to the question (indeed, it was mine), but it’s knot a superb one (Yeah, yeah, I know…)
Actually, it has to do with Entropy (the 2nd law of thermodynamics) and things tending toward ailment. In fact, the universe seems to exist in a position of ordered chaos (or chaotic order, whichever way you choose to determine it) plus your headphones are obeying the order of the Universe by causing chaos whilst inside your pocket. Maybe.
Alternatively, Summer Ash of ‘NPR.org’ says that,
“Mathematicians have studied knots forever and developed all sorts of theories and classifications of their variations, but physicists have only recently began to explore what equations govern their formation”.
She goes on to explain an experiment, distributed by Physicists Douglas Smith and Dorain Raymer, which involved rotating a length of thread with a motor to see if it is tangled or not, they did this 3,415 times. Why that exact number?
Well, depending on Smith, “The scientific answer is that 3,415 was around the point where we had statistically compelling results. The human answer is that 3,415 times was about as much as we could stand.”
You wouldn’t expect a guy who seems to have taken the term ‘String Theory’ literally to possess a sense of humour, but there you go. I’ll let Summer explain the remainder;
“They concluded that with a minimum length of string (18.124 inches) and sufficient space for the string to shift around in its container, knots formed fairly quickly, often within the first few seconds. Inputting these results into a computer model, they even managed to create a program that could identify the “Jones polynomial” for each resulting knot, a mathematical property based on parameters such as the number of string crossings”.
Ergo, when you consider the extent of your earphone chord and how much space these have to move around in your pocket (especially when you’re out and about, going to/from work, jogging, walking the dog or whatever), it will become clear for which you’re knot going to avoid the odd entanglements (sorry. I’ll stop now). It’s just physics. In fact, if it does not happen all the time, you have almost certainly beaten odds close to winning a good amount at the lottery. Consider that.
Anyhow, to sum up, today, we have now learned together that intertwined earphone cables are a natural symptom of business as usual within the Universe. It is indicative of the great wide somewhere winking down at us and reassuring us that it is all going to be alright and that everything goes exactly according to plan. A means of saying the days of our lives are as preordained as every grain of sand on every single beach on each world in each galaxy…
Or, if you favor, the Universe is essentially a Grant Morrison re-write of the Phillip K. Dick wet dream.
Or, if you like:
Headphones get tangled up inside your pocket. Why? Because they simply do.