Hand sanitizer evaporates, or at least the alcohol component that does the bulk of the sanitizing does.
Soap and the physical abrasion of scrubbing your hands damages cell walls, killing the microbes. The assorted gunk of those destroyed microbes, dirt, oils, etc… Is also loosened and suspended in the suds so it can be washed away readily with water.
There’s only so much the soap can do, leaving it longer doesn’t help much, but if you fail to wash it away most of that crud and any surviving microbes are left on your hands as food for the next batch of germs.
This is actually one of the big problems with sanitizer, it doesn’t take things away like properly washing and rinsing does and many of them leave residual oils or other substances added for scent or whatever. That’s fine for a quick touch up now and then but does not at all replace regular hand washing to get rid of all that.
Latest Answers