I'm looking for specifications for Gigabit Ethernet in connection with PoE. I saw somewhere that 1000BASE-T uses all 8 lines of the twisted pair cable. If that is the case, how does it work with PoE?
The wikipedia article (https://en.wikipedia.org/wiki/Power_over_Ethernet) explains it quite nicely:
Standards-based power over Ethernet is implemented following the specifications in IEEE 802.3af-2003 (which was later incorporated as clause 33 into IEEE 802.3-2005) or the 2009 update, IEEE 802.3at. A phantom power technique is used to allow the powered pairs to also carry data. This permits its use not only with 10BASE-T and 100BASE-TX, which use only two of the four pairs in the cable, but also with 1000BASE-T (gigabit Ethernet), which uses all four pairs for data transmission. This is possible because all versions of Ethernet over twisted pair cable specify differential data transmission over each pair with transformer coupling; the DC supply and load connections can be made to the transformer center-taps at each end. Each pair thus operates in common mode as one side of the DC supply, so two pairs are required to complete the circuit. The polarity of the DC supply may be inverted by crossover cables; the powered device must operate with either pair: spare pairs 4–5 and 7–8 or data pairs 1–2 and 3–6. Polarity is required on data pairs, and ambiguously implemented for spare pairs, with the use of a diode bridge.
The Wikipedia answer Teun posted is correct but is pretty dense and hard to follow for someone who is not up on EE terminology. Here is my attempt at a less jargon heavy version.
Signals are transmitted as a voltage difference between the two wires in a pair while power is transmitted as a voltage difference between two pairs. Ethernet is transformer coupled so the transmit and receive electronics only see (in principle, nothing is perfect) the voltage between the two wires of a pair. The power connections are taken from a center tap on the transformers so they only see the voltage between the two pairs.
The large difference in frequency also helps keep the signal and power from interfering with each other but it's not the primary separation mechanism (unlike with POTS).
Regarding transformer center tap: there's a diagram over on https://electronics.stackexchange.com/questions/377395/requirement-of-center-tap-in-poe-applications that likely explains more than 100 words.
With Ethernet in general, the twisted pairs are electrically decoupled from the host potential by using transformers ('magnetics'). Accordingly, the cable is 'floating'. PoE exploits that fact and the PSE injects a DC voltage on two center taps in the forward transformer coils. The wires within each pair remain DC neutral to each other (the data is carried as AC), but in between the two pairs there's a net DC voltage that you can extract on the PD end.
Note that the diagram shows dual-pair PoE Alternative A as introduced with 802.af-2003. Alternative B uses the 'spare' pairs not used with 10BASE-T and 100BASE-T. Of course, 1000BASE-T upwards have no unused pairs, so transformer middle taps are always required.
802.3at-2009 aka PoE+ increased the maximum current to 600 mA. There's also four-pair PoE aka 4PPoE introduced with 802.bt-2018 that uses two positive and two negative pairs and up to 960 mA per two pairs.
You can get all IEEE 802 standards for free after registration here: http://ieeexplore.ieee.org/browse/standards/get-program/page/series?id=68
"The answer is through the use of phantom power—power sent over the same wire pairs used for data. When the same pair is used for both power and data, the power and data transmissions don’t interfere with each other. Because electricity and data function at opposite ends of the frequency spectrum, they can travel over the same cable. Electricity has a low frequency of 60 Hz or less, and data transmissions have frequencies that can range from 10 million to 100 million Hz"