Apple headphone remote doesn't always work
There are 4 contact areas (poles) on your headphone jack, off the top of my head it's Left Audio, Right Audio, Ground and Control (doesn't matter of this isn't wholly right) and each one when inserted into the socket forces a tiny switch to be pushed in, thus alerting the device to the presence of something plugged in.

My google-fu cannot get a diagram as it would explain it better, but when you insert the headphone end into the socket, you are essentially applying vertical force to the rounded end of a tiny sprung push switch, and forcing it to move horizontally to engage the switch mechanism.  It's doing this 4 times against 4 tiny switches.

When these switches get gummed up, they can act odd.  It's not hard to see how they can get dirty given that they are essentially open to the environment, albeit down a little hole.  More common is the switches refusing to reset to the normal position when you take the headphones out, resulting in muted devices as it still thinks headphones are attached, but it's perfectly possibly for them to not push in properly too, or have enough dirt accumulated to make a poor contact.

To rectify it, insert and remove your headphone jack loads of times as fast as you can, spin it round in the socket, and generally agitate the switch mechanisms.  Some would have you apply a tiny bit of WD-40 to the headphone end (Don't spray into the socket!) first.