Its all done through the use of black magic and voodoo, otherwise known as the "Registry". The registry is not something to mess around with, unless you really know what you're doing, as one wrong move can render the machine unbootable and useless, and require a complete reinstall. Most techniques for changing the identity of a user usually only result in partial changes. For example changing the user name from John to Fred, will on the face of it appear to work, but when you look deeper you'll find that most of the underlying folder structures and registry entries will still retain the old John names. To change them would break all sorts of dependencies throughout the system file structure, and is therefore not really worth attempting.
The technique I listed is the simplest way, to create a new clean account with the details you want. Copying stuff into it from a previous account can be problematic. It might require you to reboot the machine into safe mode, log in as administrator and take ownership of certain files and folders in order to be able to copy them to the new location.