So from a fairly early time, gamemakers employed a variety of mechanisms to prevent unlicensed copying. Many of these were poorly implemented, and tended to either be prone to locking a player out of playing a legal copy, being trivial to circumvent, or being so annoying that players chose to play something else.
One early method, called "key disc" protection, required that the game access its original disc during loading — metadata not normally preserved when a disk was duplicated was required to play the game. This was prone to failure, made games unplayable on newer machines (as this out-of-band data could not always be found by new hardware), and prevented the player from using a (perfectly legal) personal "backup" copy. Given that floppy disks had a typically short operational lifespan, this also had bad effects for long-term survival. Even a few CD-ROM based games used this method, intentionally introducing errors to the disk, then refusing to run if the error-correction mechanism did less work than expected.
The most expensive early system was to require that a piece of specialized hardware be attached to the machine, but this was hardly ever used outside of server-grade software. Some modern productivity software (in the $500+ range) uses a USB dongle key with decoding information built-in.
A more reliable (but also more intrusive) method was to require some piece of information from the game's manual to play. This could require the player to look up a code (or look up "the third word on page seven of the manual"), or, much better, solve a puzzle using clues from the Feelies. Some very early games even used this to save disk space by putting most of the expository text in hardcopy, sort of like a Choose Your Own Adventure book (complete with "red herring" exposition to discourage you from peeking at parts you aren't supposed to read yet).
The simpler forms of this could be beaten with a photocopier. A few games tried to make this, too, infeasible. The Carmen Sandiego games, for instance, could request information from anywhere within the almanac-sized book that came with the game, which was often the current year's World Almanac and Book of Facts, which was also sold separately. SimCity's copy protection codes were untypeable symbols and printed in black on a dark red page to thwart (primarily black-and-white) photocopying. Games like Railroad Tycoon or Indianapolis 500: The Simulation required the player to identify a 2-8-0 Consolidation or Johnny Rutherford's 1976 winning McLaren Offenhauser, although this was trivial to a trainspotter or race fan (the very kind of person who'd want to buy such games). Old Disney games often came with a two-layer card stock disk, with the bottom layer having various words printed on it and the top layer having sections with cutouts; the game could then ask you to turn one section of the disk until you saw a certain word, and then read off the word displayed on another section, supplying at least the number of possible keys as your average combination lock.
Since 1983, Macrovision started copy-protecting commercially released VHS tapes and Betamax tapes, As well as Laserdiscs, DVDs, Blu-Rays and even premium cable and satellite channels (although in the case of DVDs and Blu-Rays, the discs themselves don't ship pre-encoded- in this case, the disc ships encoded in CSS and AACS respectively and the Macrovision signal generator is housed in the DVD or Blu-Ray player itself and is switched on by the player the moment it detects a disc to be CSS or AACS encrypted. And at the start of the commercially released VHS tape or a Betamax tape, It starts with the FBI Warning Screen stating that copying whole or in parts of the cassette is strictly prohibited. And it would result into a punishment of 5 years in prison and/or a $250,000 fine. Same thing happens when you load a Laserdisc, a DVD disc or Blu-ray disc.
With the rise of the CD-ROM and the fall of printed manuals, this sort of copy protection faded away. For the years until CD duplication became cheap, the medium itself was considered good enough copy protection.
The Internet was probably the final nail in the coffin for most of these schemes, with all the secret codes now being accessible with just a few mouse clicks. Even in times when DOS (or Win 95 exclusive DOS mode, for that matter) didn't allow the player to switch and look at a solution in a plain text file, it still could be printed, or easily bypassed via DOS multitask extensions and programs like Game Wizard.
But now, things have come full circle again. Most software now uses Internet-based copy protection, requiring the game to communicate with the publisher's servers to activate. Some games only need to be activated once during installation or on first run, whereas others more annoyingly must connect to the servers every time they are launched. The latter presents a problem to anyone wishing to play the game away from an internet connection, such as on a laptop on the go.
However, companies love this option to pieces. Games with an on-line component can implement such a mechanism "for free" within their own authentication structure. Of course, in the event that the company goes under, no one will ever be able to play their games ever again. Or, even if they're still in business, there's the question of exactly how many people need to keep playing an older game before the economics of appeasing fans of old titles comes into play. But the companies don't care so much about that. In fact, some probably like the idea of simply turning off the activation server for Mega Quest and thereby forcing all their users to buy Mega Quest 2.
Modern games simply fail to run if not authenticated. Earlier games tended to let you play a small part of the game, or play at a massive disadvantage, even if copy protection failed. In SimCity, failing the copy protection would cause a non-stop stream of disasters to strike your city, making the game all but unplayable. (This sort of thing may have been intended, though, as another protection against people breaking the copy protection, since there was a chance someone idly examining the game before distributing it illegally might not have realized it had copy protection at all.)
In theory, the only way to have fine-grained control over what end-users can or cannot do with software is to physically separate it from them via a client/server arrangement. In this setup, the client only serves as a front-end — sending player input to the server and outputting streaming audio and video from the server. With a competent IT staff, infringement all but ceases to exist, yet each player is at the mercy of the server's uptime and bandwidth requirements for streaming audio and video. OnLive, a retail PC game streaming platform, inherently uses this delivery format. With servers being overloaded and game companies bombing on a regular basis, this ends up being one of the least reliable systems in terms of gameplay and game longevity.
Expensive or specialty software may use a hardware attachment called a software protection dongle. The dongles used serial or parallel ports when they the devices was first incepted, but modern dongles use a USB port and resemble an ordinary USB drive. This is one of the more effective methods of copy protection, but the program has to be expensive enough that the $20 cost of the dongle would not be unreasonable to the purchaser.
The only thing that cannot be defeated is charging a monthly fee, and that really only works for massively multiplayer online games and other stuff that runs off of a central server. And sometimes even that isn't immune, especially when a popular game has private player-run servers start popping up.