How does donated blood that has some kind of infection sometimes pass through all the screening tests?

Timing. If the blood donor was recently infected with HIV or another virus like hepatitis, it may not show up in the blood test. That's why there are so many questions a blood donor must answer before donating, to hopefully rule out any chance for a recent infection.
Depends on test. Donated blood goes through fairly extensive testing, but is not tested for every possible infection known to man. Tests that are currently done include hiv, hepatitis a, hepatitis b, hepatitis c and liver function. Remember also that no test is ever 100% accurate 100% of the time; false negatives do occur.