The 3-7-1 weights
An ABA routing transit number is 9 digits, and the ninth is a check digit. Multiply the digits by 3, 7, 1, 3, 7, 1, 3, 7, 1 and the sum has to end in zero.
The weights are what catch a transposition. Two adjacent digits swapped almost always change the weighted total, which a plain sum would not.
Wire numbers and ACH numbers
Many banks publish one routing number for ACH and a different one for wires. Both are valid 9-digit ABA numbers and both pass this check, so a passing result does not tell you which rail the number belongs to. Confirm that against the bank’s own page before sending anything.