Reading the quantum phase estimation algorithm on Wikipedia, I am wondering how exactly the measurements are used to obtain the phase $\delta$. I understand that the value of phase is encoded into the binary string that represents a computational state. My question is more about what extra information can be extracted from the probabilities. If I perform the measurement in the computational basis, i.e., $|a\rangle$ in the notation used on Wikipedia, what I obtain is a list of probabilities for each state. (Imagine the case $\delta\neq 0$). How exactly can I get this $\delta$ from these probabilities? Since the probability $\text{Pr}(a)$ is what I get and is expressed in terms of $\delta$, do I have to inverse the following function
$\text{Pr}(a) = \frac{1}{2^{2^{n}}}\frac{|\sin(\pi 2^{n}\delta)|^{2}}{|\sin(\pi\delta)|^{2}}$
in order to get $\delta$?
Meanwhile, how does the algorithm recognise the nearest integer to $2^{n}\theta$? The only way I can imagine is that the probability that corresponds to a certain state is greater than other. Imagine I do not approximate, $\textit{a priori}$, $2^{n}\theta = a + 2^{n}\delta$, then what I obtain is this list of probabilities for each $a$. It appears I can use any of them to estimate the phase. In this case, which probability shall I use?