How do HDD scans work? I tried a google search but no luck.
If I had to 100% guess: Checks the 'flaw flag', the ECC, then maybe reverts the data back and forth making sure it can always read/write correctly?
Depends what you're trying to do. The basic simple file-integrity chkdsk style scan just looks at all the files and other entries to make sure all the chunks exist and don't have gaps.
The more detailed sector-by-sector scan (the one that takes 2 hours) simply reads a sector and then tries to rewrite it and then read it back again. If any of that process fails to produce the correct result, the sector might be bad and you get a warning. The tool can then flag those sectors as bad so they won't be used again. Some sectors are actually flagged at the factory due to errors in manufacturing and there are usually a pool of unused sectors for remapping on the drive.
Internally, the device is often storing ECC information, too and this may be taken into account when checking the disk, but I couldn't find any documentation that tools like chkdsk are aware of this ECC information, and it may only be used to reconstruct bitwise errors on the disk surface itself. Hopefully others can fill in these details.