USB connectors inter compatibility
The 4 contacts found on type A and type B connectors are Power, Ground, Data+, and Data-. Power is at +5V, signaling is at 3.3V; the USB spec for cable length is such that these voltages will not drop beyond a certain value given the resistance of the wires.

The 5th conductor found on mini- and micro-USB connectors is the ID pin; it is either left floating or tied to ground via a resistor. It signals to the device what is at the other end of the cable; if floating then the other side is considered a USB host, whereas various resistances indicate presence of a charger or a media or communications device, or that the device plugged in should act as a OTG host (0ohms).

The physical pins have a specific order that is defined in the USB spec.