In two-tailed t-test, under assumption $H_0$ that $\mu=0$, we create a distribution for $\hat{\mu}$, which looks like this:
Now, the procedure to reject $H_0$ (with threshold 5%) is that we look at the middle part of this distribution that has 95% of its AUC
and reject $H_0$ if the actual sample mean does not fall in this area.
Now, here is a question: What is the mathematics behind the fact that we are looking at the middle part of the distribution, and not some other part. For instance, why considering this area (which is also 95% of AUC) does not let us reject $H_0$:

To clarify, intuitively I understand what's going on. But I fail to find any mechanistic mathematical approach that, given $H_0$ and $H_1$, leads me to the middle part of the distribution, rather than any other part.


You want to choose a region such that the probability of making a Type I error is 5% and the power is maximal (for any non-zero value of $\mu$). It turns out that for an iid normal sample, choosing this middle region indeed gives maximal power: the t-test is the uniform most powerful test (UMP).