The PS3 is powered off, and a special USB dongle, known as the Jig, is connected. The PS3 is then turned on, and then off, once it has detected the Jig.
After this occurs, the PS3 is then turned back on, into "Service" Mode. From here, the PS3 is re-flashed using a Firmware Update on a USB stick, specifically designed to only install from the Service Mode. Once the PS3 is re-flashed with the software, it is then used in conjunction with a PC running customized software, specifically the DEX.exe and CEX.exe's.
There are a multitude of special PS3 firmwares, basically three major ones. The first is a Core System, followed by the Service System, then finishing it off with the Final Software.. usually Retail.
From the CEX/DEX PC side software, just about anything can be done: Copying, transfer and resigning of box-specific items like PSN games, user profiles, etc.
Furthermore, the systems can be re-flashed to any software version as well. The system's keys can also be "rearranged", such as the marrying of the PS3's BD-ROM Drive (or controller) with the mainboard.