Generally the bank scanners are excellent at detecting counterfit bills but the tellers also go through extensive training to identify counterfit. The type of paper , watermarks, magnetic strip, see that the number 100 on the bottom of the bill changes color in the light.
People get upset when the bank confiscates the bill but that is what they have to do. The bank send the department of the treasurer so they can investigagte.