The general principle behind copy protection on PC games is that some aspects of the CD can be read by a drive, but can’t be reproduced accurately by a burner. That is, making a bit for bit copy is impossible.
The EFM encoding Jayrot mentioned is one example. For various technical reasons, CD readers like to see a roughly equal number of 1s and 0s. EFM is part of this process, converting 8 bits that may have any bit pattern to 14 bits that have about the same number of 1s and 0s (also, not too many 1s or 0s in a row). But for certain repeating patterns, EFM by itself isn’t enough - writing those patterns will still gradually produce more and more 1s than 0s (or vice versa). The CD burner has an opportunity every so often to write “garbage” bits, used only to even out the number of 1s and 0s… but some burners are unable to correctly calculate which bits they should write to even it out, which makes that part of the disc unreadable. OTOH, every bit can be precisely controlled when the original CD is mastered, so the original is still readable.
Another example is sectors with duplicate numbers. Each sector of data on the CD is identified by a number, and these numbers are supposed to be unique, but someone figured out that if you have two runs of sectors with the same numbers, but different data, then you can tell them apart by moving to another part of the disc before you try to read the duplicated areas. If you seek from the start of the disc, you’ll read the first copy; if you seek from the end of the disc, you’ll read the second copy. But the typical CD copying program reads sectors in order, starting from the beginning of the disc, so it’ll only see one copy of those duplicated areas!
A more complicated example is sectors with varied spacing. Most CDs have sectors laid out evenly in order: at a certain distance from the center of the disc, the angle between sector N and sector N+1000 will always be the same. But some protected discs have managed to change this, perhaps by inserting dummy sectors, duplicating other sectors, etc. You can make a copy of these discs, but the program carefully checks the angle between certain sectors at runtime (by measuring seek times), and rejects copied discs that have the usual angle between those sectors instead of the tweaked angle.
A much simpler example is CSS, the encryption on DVDs. The content on the disc is encrypted with a key that’s stored right on the disc, but the area where the keys are written is unwritable on the blank discs you can buy in stores. You can read the key from a purchased disc, but you can’t write it onto a copy.
Protection on audio CDs must be weaker, because the discs have to stay compatible enough with the CD specifications that most CD players will read them. Typically, protected audio CDs take advantage of newer CD features that old CD players ignore, but PCs (and newer CD/MP3 players) will investigate and get confused by. For example, the simplest kind of protection (the kind you can bypass by holding Shift) is just a hybrid CD with one audio session and one data session. A CD player only cares about the first session, so it sees the disc as an audio CD, but a PC only cares about the last session, so it sees the disc as a data CD that may contain encrypted music files, animation/videos, or maybe nothing at all.