Suppose you're at a point $(a, 0)$ of an ellipse (with equation $ \dfrac{x^2}{a^2} + \dfrac{y^2}{b^2} = 1$ with $a > b > 0$). You're currently looking at the tangential direction towards positive $y$. You choose an initial angle $2 \pi > \alpha > 0$, rotate anticlockwise by $\alpha$ and then shoot a laser. For which values of $\alpha$ will the laser go back for you? Notice that the laser may miss you at first and then come back.
This question is related to mine, but not exactly.
If $a=b$, the solution is trivial (we need $2 \alpha N = 2 \pi M$ for some positive integers $M$ and $N$ and from here we get that the set of all values of $\alpha$ that work are the ones of the form $r \cdot \pi$ with $r \in \mathbb{Q}$). But what about other values of $a$ and $b$? Is there a way to nicely express the set of all $\alpha$ that work?
All reflected laser beams are tangent to an inner ellipse, confocal with the outer one. A very simple geometrical proof can be found in Tabachnikov's book "Geometry and billiards", Theorem 4.4.
Due to Poncelet's porism, if the reflected beams form a closed path, then the same is true whatever the position of the laser, provided the first beam is tangent to the inner ellipse. To answer the question, we then need to find the inner ellipse giving a closed path with $n$ sides.
This was completely solved by Cayley with the method outlined below. For a proof, see for instance: Henri Lebesgue, Les coniques, Paris 1955; or: P. Griffiths and S. Harris, On Cayley's explicit solution to Poncelet's porism, L'Enseignement Mathématique (sér. 2) 24:31-40, 1978.
Suppose $A$ is the $3\times3$ matrix of the outer ellipse and $B$ the matrix of the inner ellipse. Let's consider the formal expansion of $\sqrt{\det(\lambda A+B)}$ in powers of $\lambda$: $$ \sqrt{\det(\lambda A+B)}=\sum_{k=0}^\infty c_k\lambda^k. $$
The conditions for a closed path with $n$ sides to exist can be written in terms of coefficients $c_k$:
if $n=2p$ is even, the condition is $$ \det\pmatrix{ c_3 &c_4 &\ldots & c_{p+1}\\ c_4 &c_5 &\ldots & c_{p+2}\\ \vdots & \vdots &\ddots &\vdots \\ c_{p+1} &c_{p+2} &\ldots & c_{2p-1}\\ }=0; $$
if $n=2p+1$ is odd, the condition is $$ \det\pmatrix{ c_2 &c_3 &\ldots & c_{p+1}\\ c_3 &c_4 &\ldots & c_{p+2}\\ \vdots & \vdots &\ddots &\vdots \\ c_{p+1} &c_{p+2} &\ldots & c_{2p}\\ }=0. $$
Note that this result applies to any couple of conic sections, not necessarily confocal. To apply them to our case, we can consider an outer ellipse with semi-axes $a$, $b$ and a confocal inner ellipse with semi-axes $\sqrt{a^2-t}$, $\sqrt{b^2-t}$, where parameter $t$ is to be found. Matrices $A$ and $B$ are then diagonal and we can compute: $$ \det(\lambda A+B)= -(\lambda+1) \left(\frac{1}{a^2-t}+\frac{\lambda}{a^2}\right) \left(\frac{1}{b^2-t}+\frac{\lambda}{b^2}\right). $$ From that the expansion can be made (I used Mathematica) to obtain: $$ c_2=- \frac{-3 a^4 b^4+2 a^4 b^2 t+a^4 t^2+2 a^2 b^4 t-2 a^2 b^2 t^2+b^4 t^2} {8 a^4 b^4 \sqrt{\left(a^2-t\right) \left(t-b^2\right)}}, \\ c_3=-\frac{a^6 b^6-a^6 b^4 t-a^6 b^2 t^2+a^6 t^3-a^4 b^6 t +2 a^4 b^4 t^2-a^4 b^2 t^3-a^2 b^6 t^2-a^2 b^4 t^3+b^6 t^3} {16 a^6 b^6 \sqrt{\left(a^2-t\right) \left(t-b^2\right)}} $$ and so on.
In case $n=3$, the condition reduces to $c_2=0$. The only acceptable solution ($0<t<a^2$ and $0<t<b^2$) is given by: $$ t=\frac{-a^4 b^2 -a^2 b^4+2 \sqrt{a^8 b^4-a^6 b^6+a^4 b^8}} {a^4-2 a^2 b^2+b^4}. $$
For $n=4$ the condition reduces to $c_3=0$, which gives: $$ t=\frac{a^2 b^2}{a^2+b^2}. $$ You are encouraged to check these results and possibly find the solution for $n=5$. Note that for $n=5$ there should be two valid solutions: one giving a pentagonal path and the other a star-like path.
In figure below inner ellipses are drawn for $n=3$ (blue) and $n=4$ (red), starting with an outer ellipse having $a=3$ and $b=2$, and using the formulas given above.