Theorem 4 (Strong maximum principle) Evans. The following is from Section 2.2 of Evans' PDE book: Screenshot here, transcribed below

THEOREM 4 (Strong maximum principle). Suppose $u \in C^{2}(U) \cap C(\bar{U})$ is harmonic within $U$.
(i) Then
$$
\max _{\bar{U}} u=\max _{\partial U} u .
$$
(ii) Furthermore, if $U$ is connected and there exists a point $x_{0} \in U$ such that
$$
u\left(x_{0}\right)=\max _{\bar{U}} u,
$$
then
$u$ is constant within $U$.
Assertion (i) is the maximum principle for Laplace's equation and (ii) is the strong maximum principle. Replacing $u$ by $-u$, we recover also similar assertions with "min" replacing "max".
Proof. Suppose there exists a point $x_{0} \in U$ with $u\left(x_{0}\right)=M:=\max _{\bar{U}} u$. Then for $0<r<\operatorname{dist}\left(x_{0}, \partial U\right)$, the mean-value property asserts
$$
M=u\left(x_{0}\right)=f_{B\left(x_{0}, r\right)} u d y \leq M .
$$
As equality holds only if $u \equiv M$ within $B\left(x_{0}, r\right)$, we see $u(y)=M$ for all $y \in B\left(x_{0}, r\right)$. Hence the set $\{x \in U \mid u(x)=M\}$ is both open and relatively closed in $U$ and thus equals $U$ if $U$ is connected. This proves assertion (ii), from which (i) follows.

Question 1. Why $\int_{B(x_0,r)}u\,dy\leq M$? even though we already know that $u(x_0)=M=\int_{B(x_0,r)}u\,dy$
Question 2. Why does equality imply that $u\equiv M$ within $B(x_0,r)$?
 A: $\newcommand{\avint}{⨍}$

*

*Since $M = \max_{\overline U} u$, it follows that $u(x) \leqslant M$ for all $B(x_0,r)$. Hence, $$\avint_{B(x_0,r)} u(x)\,dx=\frac 1 {\vert B(x_0,r) \vert} \int_{B(x_0,r)}u(x)\, dx \leqslant \frac M {\vert B(x_0,r) \vert} \int_{B(x_0,r)}\, dx =M.$$


*Since $M= \max_{\overline U} u$ and $ \avint_{B(x_0,r)}u(x)\,dx=M $, we must have $u(x)=M$ for all $x\in B(x_0,r)$.
Some intuition: Think about if you were taking the average of $N$ numbers $x_1,\dots,x_N$. If $M=\max \{ x_1,\dots,x_N\}$ and the average of these numbers of $M$ then we must have $x_i=M$ for all $i=1,\dots,N$. If any one number was less than $M$ then there average must be less than $M$.
For the actual statement we are of course not dealing with discrete numbers, but the logic is still the same. Suppose that there exists $x_1\in B(x_0,r)$ such that $u(x_1)<M$. Since $u$ is continuous there exists $r_1>0$ sufficiently small such that $B(x_1,r_1) \subset B(x_0,r)$ and $u(x) <\frac{M+u(x_1)} 2$ for all $x\in B(x_1,r_1) $. Then \begin{align*}
\avint_{B(x_0,r)}u(x)\,dx &=\frac 1 {\vert B(x_0,r) \vert} \bigg ( \int_{B(x_1,r_1)}u(x)\,dx + \int_{B(x_0,r)\setminus B(x_1,r_1)}u(x)\,dx \bigg) \\
&\leqslant \frac 1 {\vert B(x_0,r) \vert} \bigg ( \frac{M+u(x_1)} 2\vert B(x_1,r_1) \vert + M\vert B(x_0,r) \setminus B(x_1,r_1)\vert \bigg) \\
&=\frac 1 {\vert B(x_0,r) \vert} \bigg ( -\frac M 2 \vert B(x_0,r) \vert +\frac{u(x_1)} 2\vert B(x_1,r_1) \vert + M\vert  B(x_0,r)\vert \bigg)\\
&<\frac M {2\vert B(x_0,r) \vert} \bigg ( \vert B(x_1,r_1) \vert + \vert  B(x_0,r)\vert \bigg)\\
&<M.
\end{align*} This contradicts, $ \avint_{B(x_0,r)}u(x)\,dx =M$.
