Let $N$ be the number we're trying to factor. In Shor's algorithm, the top register then has $2 \lceil\log_2(N)\rceil+1$ qubits, while the bottom register (the ancilla qubits) has $\lceil\log_2(N)\rceil$ qubits.
This is stated in my lecture notes on slide 25.
I believe I have an approximate understanding of Shor's algorithm: the end result on the top register, $\left| x_{\text{final}} \right>$, is such that $\frac{x_{\text{final}}}{T} = \frac{s}{r}$ for some integer $s$. In the aforementioned equation, $T=2^{2 \lceil \log_2(N) \rceil + 1}$ and $r$ is the oracle's (modular exponentiation) period.
The end result of the bottom (ancillary) register is the result of the modular exponentiation: $\left| f(x) + y \right> = \left| f(x) \right> = \left| a^x \mod N \right>$. The largest result possible is $N-1$, for which you require $\lceil \log_2(N - 1) \rceil$ qubits, so it makes sense that the size of the bottom register is $\lceil\log_2(N)\rceil$.
I do not however understand the choice of the size of the top register.