Birthday line to get ticket in a unique setup
Let $p_n$ be the probability that the $n$th person in line wins, and let $q_n$ be the probability that the first $n$ persons have different birthdays. Then for a generic $n$ we have $$ p_{n+1} = q_n \frac{n}{365} \\ p_{n+2} = q_n \frac{365-n}{365} \frac{n+1}{365} $$ and therefore $$ \frac{p_{n+2}}{p_{n+1}} = \frac{(365-n)(n+1)}{365n} $$ This is larger than $1$ if and only if $$ (365-n)(n+1) > 365n $$ which rearranges as $$ n(n+1) < 365 $$ Initially the $p_n$s grow steadily, but eventually they start to fall steadily towards $0$. The last $n$ for which $n(n+1)<365$ is $18$, so the largest $p_n$ will be $p_{20}$.
The probability, $p(n)$, of getting a free ticket when you are the $n_{th}$ person is line is:
(probability that none of the first $n−1$ people share birth dates) * (probability that you share birthday with one of the first $n−1$ people)
So, $p(n) = [1 *(\frac{364}{365})*(\frac{363}{365}) * ... *(\frac{(365−(n−2))}{365})] * [\frac{(n−1)}{365}]$,
Here, $0 <n \leq 365$.
Now the least $n$ such that $p(n) > p(n+1)$, or $\frac{p(n)}{p(n+1)} > 1$.
Now, $\frac{p(n)}{p(n+1)} = \frac{365}{(366−n)} * \frac{(n−1)}{n}$
$\implies 365n − 365 > 366n − n^2 $,
$\implies n^2 − n - 365 > 0$
$\implies (n - \frac{(1+\sqrt(1461)}{2})*(n - \frac{(1-\sqrt(1461)}{2}) > 0$
$\implies n = \frac{(1+\sqrt(1461)}{2} = 19.6115148536 $ ($\because n>0$)
$\implies n = 20$ (ceiling of computed value)
Hence the $20^{th}$ position maximizes the chances.
Note: See my first comment below if you don't want to solve quadratic equation using discriminant method.