You can ignore the straight track; sending a car through it is equivalent to putting it onto the spur and taking it out immediately. (At least if you don't care about which orientation the cars end up in).
Thus, a plan for what you do will be some mixture of $n$ "put a car into the spur" operations and $n$ "take a car out from the spur" operations. Two different sequence of operations will always lead to different permutations (why?), and a sequence of operation is valid if no prefix of it has more "take out from spur" operations in it than it has "put into spur" operations.
This means that every valid operation sequence corresponds uniquely to a _string of matching parentheses_ of length $2n$, and the number of such strings is the Catalan number $C_n=\frac1{n+1}\binom{2n}n$.