For multi-rail shots, just expand the solution of Alex, above. Reflect the pool table left and right, above and below the original pool table. Include reflections of reflections. It might help to color the original four sides in four different colors, to keep track of which side is which in the reflected pool tables. Be sure to also reflect the target ball. Now draw a straight line from the cue ball to any reflected target ball. That line will represent a possible direction for the cue ball to hit the target; the real and reflected sides that get crossed are the ones the real ball bounces off in its path to the target.
EDIT: Using mathematics to analyze the theoretical solution:
Take the "billiard table" as being the region one ball radius in from the actual bumpers on the real table (Thank you, Johannes). Let the origin be at the lower left corner of this table, with width $W$ in the $x$ direction and height $H$ in the $y$ direction. Place the cue ball at $X_c,\,Y_c$, and the target at $X_t,\,Y_t$.
Assume you want to do a bounce off the left cushion and then the top cushion, before hitting the target. The reflection in the left cushion places the reflected target at $-X_t,\,Y_t$, while the reflection of this reflected target in the top cushion places the reflected reflected target at $-X_t,\,(2H-Y_t)$
The line from the cue ball to the doubly reflected target is at an angle $\theta$ where:$$\theta = \tan ^{-1} \left( \frac{(2H-Y_t)-Y_c}{-X_t-X_c} \right)$$
Note that the angle may need to have $\pi$ radians added, depending on the actual quadrant.
This is basically a long comment about OP's linked solution to the $2$-ricochet case: You're right, it's a "mess". :)
Don't feel too bad, however. It took me a couple of tries to find a clean approach. A first attempt involved an irreducible cubic; the second, a cubic with an extraneous linear factor. However, a little perseverance and geometric insight finally got me to just the core quadratic relation.
Below is an illustration of (half of) the $2$-ricochet case, where Captain America stands at point $C$, distance $c$ (with $0 < c \leq 1$) from the center $O$ of a unit-radius room:
Here, $T$ is the first ricochet point (the second being the reflection of $T$ in $\overleftrightarrow{OC}$), and necessarily-acute $\theta$ is both the angle of incidence and reflection of the shield bouncing off of the wall at $T$. Similar right triangles in the figure give us this relation:
$$\frac{\cos\theta}{c+\sin\theta} = \frac{\sec\theta}{2c} \quad\to\quad 2 c \cos^2\theta = c + \sin\theta \quad\to\quad 2 c \sin^2\theta+\sin\theta- c = 0$$
Solving for $\sin\theta$ gives
$$\sin\theta = \frac{1}{4c}\left( -1 \pm \sqrt{ 1 + 8 c^2 }\right) \qquad\to\qquad \sin\theta = \frac{1}{4c}\left( -1 + \sqrt{ 1 + 8 c^2 }\right)$$
Where the acuteness of $\theta$ allows us to replace "$\pm$" with "$+$". $\square$
(Sanity check: When Cap stands at the wall, so that $c=1$, the formula gives $\sin\theta = 1/2$. That is, $\theta = 30^\circ$, just as one would expect when $C$ and $T$ are vertices of an inscribed equilateral triangle.)
Best Answer
Basic approach. Imagine an infinite grid. An imaginary ball, corresponding to the real ball on your screen, starts in the unit square. It starts moving in some direction and continues moving forever in that direction.
When it passes a line of the form $x = j$, where $j$ is an integer, that corresponds to the real ball bouncing off either the left or the right side of the screen. When it passes a line of the form $y = k$, where $k$ is an integer, that corresponds to the real ball bouncing off either the upper or the lower side of the screen.
The imaginary ball always moves in the same direction, but the real ball, of course, changes direction each time it passes one of these integer lines.
However, the moments at which the imaginary ball encounters a corner of the form $(j, k)$, where $j$ and $k$ are both integers, correspond to those moments when the real ball hits a corner as well. So the question is, given an initial starting point $(x_0, y_0)$ and a velocity vector $(v_x, v_y)$, if the line
$$ \frac{y-y_0}{v_y} = \frac{x-x_0}{v_x} $$
has an integer solution. If so, the displacement between the initial point $(x_0, y_0)$ and the solution point $(j, k)$, along with the component velocities $v_x$ and $v_y$ will tell you how long it takes to get there.
I'll try to add more about this problem when I get more time.