Unless you're talking about some special brand headphones, there isn't exactly "data" transfer in the sense of digital data transferred from or to some IC on the headphones. The information what type of connector is present is decoded quite differently. This Application Note is quite a good reference for this. I'll quickly summarize the key facts for you, but I recommend reading that application note.
The basic idea is that on traditional 3-contact jacks, the sleeve is ground, and the first ring and tip are the two speakers. What is to be kept in mind is that they have a rather low impedance.
A typical microphone-enabled jack now moves the speaker on the tip of the jack to a second ring (that is mechanically in one half of the tip in the first variant) and connects the microphone to the tip. The microphone itself is quite high impedance. This microphone also needs biasing, i.e. a resistor in the order of a few Kiloohms from the tip to the supply voltage is required for operation.
In Variant 1, if the low impedance speaker is connected to the tip and thus to the resistor, a very low voltage can be read on that pin. In Variant 2, if the high impedance microphone is connected, higher voltage is present.