My goal is to find the best estimation for 'p' in a sample of N measures.
You haven't defined "best", but I'm willing to bet that one of the properties of the Maximum Likelihood Estimators might fit whatever description you're thinking of. When the likelihood is well behaved, as it would be here, estimates are consistent, efficient, and are asymptotically normal. In some cases, they can also be unbiased.
I want to prove that the best estimation after N measures is
This is a very simple proof and you can google something like "Maximum Likelihood Estimate of Binomial Distribution" or search this website for something similar.
Also would be nice to know how many sample i should have in order to estimate p with an error x over a confidence interval C
There are a lot of confidence intervals for the binomial proportion. I will use the simplest one for now, the Wald Interval, in the hopes you can extend the methodology to a better interval of your choosing.
The radius of the interval (what you call $x$ in your comment) is
$$ x = z_{1-\alpha/2}\sqrt{\dfrac{p(1-p)}{n}} $$
When using a 95% CI, $z_{1-\alpha/2} \approx 1.96 \approx 2$ for economy of thought. We can very easily solve for $n$
$$ n = \dfrac{4p(1-p)}{x^2} $$
We can further simplify this. Note that the variance of the binomial is bounded by 0.25, and that the variance appears in our expression. This results in
$$ n = \dfrac{4}{x^2}p(1-p) \leq \dfrac{4}{x^2}0.25 = \dfrac{1}{x^2} $$
So, in order to guarantee that the resulting confidence interval (regardless of the value of $p$) has a radius smaller than $x$, you need $1/x^2$ samples. Depending on the value of $p$, you might actually need a lot more. But this will guarantee a radius of $x$.