Can you provide us an understandable and detailed explanation of the relationship between prime numbers and equidistibution theory? In this site, in 2. the user that answered the question  wrote "the prime number theorem is an equidistribution theorem, and the Riemann Hypothesis an optimal discrepancy bound. By bounding this discrepancy optimally, you guarantee that there are no notable gaps in the distribution of prime numbers". We have as reference for equidistribution, update it or add the definitions and theorems that you need, my 

Question. Can you give an understandable explanation of this quote with the most important details assumed as facts? I say with some mathematics from a divulgative viewpoint. Thanks in advance.

With this question I would like to know how the definition and the main tools of equidistribution theory are related with cited theorem and hypothesis concerning prime numbers, from a divulgative viewpoint. 
 A: From the linked question--


*Counting prime numbers; the prime number theorem is an equidistribution theorem, and the Riemann Hypothesis an optimal discrepancy bound. By bounding this discrepancy optimally, you guarantee that there are no notable gaps in the distribution of prime numbers... \end{quote}


In this context "equidistribution" is a property relating primes and intervals. Paraphrasing the Wiki entry on this topic, for a sequence of primes $\{ p_1,p_{2},..., p_n  \}$ on the interval $[a,b],$ the sequence is equidistributed if for any subinterval $[c,d]$ we have 
$$\lim_{n\to \infty} \frac{|\{p_1,p_{2}, ...,p_n   \} \cap [c,d]  |}{n} = \frac{d-c}{b-a}.\hspace{10mm}(1) $$
The property can be shown for primes on some intervals but not for others, because the error of the prime number theorem limits its use.  For example,
we could show that 
$$\lim_{i \to \infty} \frac{ \pi(2^{i+1})- \pi(2^i)}{ \pi(2^{i+2})-\pi(2^i) }= 1/3$$
but, notwithstanding some empirical evidence, we cannot prove that  
$$\lim_{n \to \infty}\frac{\pi(n+1)^2-\pi(n^2)}{\pi(n+2)^2-\pi(n^2)} = 1/2.$$
The precision with which we can locate a prime on an interval is determined by the size of the error of the prime number theorem. The intervals in the first example above are "large," so the PNT estimate of the cardinality of primes on these intervals is sharp enough. That is not the case for shorter intervals such as those in the second example above.
If the Riemann hypothesis were proved it would give a marginal improvement over current error estimates for the PNT, but not enough to prove the second assertion above. 
In the linked question the author is talking about gaps in the sequence of primes. Again, the PNT gives bounds on the size of such gaps so that $p_{n+1}-p_n$ is (or is not) too large. This is just another way of looking at the same thing--if gaps are not "too big" then for some interval $[a,b]$ we can estimate $\pi(b)-\pi(a)$ with sufficient precision--and otherwise not.
The term "equidistribution" appears in many contexts but in the linked question it just relates to the accuracy of estimates of the number of primes on intervals, or (what is the same thing) the accuracy of estimates of distances between primes on such intervals. 
