A game's registration code is generally found in the back of the instruction manual or an insert in the box. If the game was purchased through a digital download service, such as Steam, right-click the title of the game in the library for the appropriate menu.
Some websites offer free game registration codes, but these sites may be pirating the software. Pirating is the illegal act of distributing software and other media by an entity not authorized to do so. Unless the media is from an authorized source, use caution, as piracy may carry a large fine and possible jail time.