Try CCleaner first. It'll usually take care of bad registry entries. If you still can't install, you have to delete the entries manually.
Manual regeditting can screw up your system though, so caution is advised... in other words, don't edit the registry unless you're absolutely sure about what you're doing.