"Protection" provides the needed clue that controls whether CCK or OFDM is to be spoken. It uses the RTS / CTS mechanism illustrated in Figure 2 that's part of the 802.11b spec. When protection is in use, each 802.11g OFDM data packet is preceeded with a CCK RTS (Request To Send).
Figure 2: RTS / CTS
From: 802.11 Wireless Networks: The Definitive Guide , used by permission 
Since CCK is spoken, all in-range 802.11b stations (or 802.11g stations using protection) can understand that a station is requesting permission to send data. The target in-range 802.11b or 802.11g station can then respond with a CCK CTS (Clear To Send) and the transmission can begin. Since the RTS and CTS frames contain other information about the data that will then be sent, 802.11g stations can tell whether they can switch back to OFDM, or need to continue speaking CCK to complete the requested communication.
TIP: For a more detailed explanation (with diagrams) of how the protection mechanism works, see this article.
As you might guess, however, this compatibility comes at a price. The RTS / CTS mechanism not only adds the overhead of more bits that need to be transmitted, received, and processed, but it also must take place at the slower 802.11b speed. (Even if someone is speaking your language, if they're talking too quickly, you still won't understand them.) All this adds up to a hit to throughput, and throughput is what 802.11g is selling!
The protection mechanism has had significant changes from draft to draft of the 802.11g spec, and may change again in the final spec that is scheduled for July 2003 release. I'll next take a quick look at the effects that these changes have on the throughput that you'll see in draft-802.11g products.