The Twist (Spoiler) and Why It Works
The reveal is that the friendly policeman in the first half was Jimmy Wells himself - the very friend Bob came to meet. Arriving for the appointment, Jimmy recognized Bob as a criminal wanted by the Chicago police, and faced an impossible choice between his twenty-year friendship and his duty as an officer. He solved it by neither letting Bob go nor arresting him personally: he sent a plain-clothes detective to make the arrest, and left a note explaining. The twist works because O. Henry plays fair - every clue is there - while steering our attention away, so the ending feels both shocking and, in hindsight, inevitable.