The reason balls can reverse sharply off rails like this is rail compression.
The compression changes the direction of the ball, and also imparts some spin.
(spin will be imparted from contact with the rail regardless of compression,
but I think on a fast shot, compression imparts a lot of spin).
So on the right is what would happen if the cushion didn't compress/deform.
The ball would bounce off a perfectly flat, ruler-straight surface and rebound along a mirror angle.
On the left is what actually happens, the rubber compresses, and "cups" the ball.
So now it's bouncing off a curved surface.
The direction it rebounds, is determined by the part of the curve that is the most heavily compressed,
which is sort of perpendicular to the direction the ball is moving.
So in the above example, imagine the curved area of the cushion divided into 2 parts.
The part to the left of the cue ball's black arrow, and the part to the right.
The part to the right (marked with the red bar) is what gets compressed heavily,
and that has the most influence on the rebound angle.
It gets crushed, then decompresses and spits the ball back.
Meanwhile, the part of the rail to the left also compresses, but I think it has less influence on the direction of the ball
because it doesn't compress as heavily, so it doesn't snap back as forcefully.
The next part is just a guess/theory but I think that area on the left DOES impart a lot of spin, because for a split second,
a lot of the cue ball's surface is rubbing against the rail which is partially cupping it.
It's sort of like the ball is "scraping" that left portion of the rail as it attempts to "pass it by".
But of course it can't pass it, it hits the hard wall of rubber marked in red on the right.
This pic might help explain what I mean by the left part of the compressed area imparting lots of spin: