Depends on the system and how much you have to clean. The easiest method would be to do a system wipe and reinstall the OS. But then you have to reinstall all your software, set-up the settings in said software and set up the OS settings the way you like.
The better option would probably be just clean the system manually. Uninstall the programs you're not using, check all the hidden folders and registry for left overs etc.. Though that won't put the OS back to factory settings like the first option will.