Light repeatedly hits the walls as it travels down the fiber optic cable. Due to the extremely shallow angles at which it strikes the glass, the light beam does not escape through the edges. Then, as if the glass were a true mirror, it reflects. We call it complete internal reflection. The cable structure is another element that keeps it inside the pipe.