Let $T:X \to X$ be a continuous function on a compact metric space. We say that $\mu$ is $T-$invariant if $\mu(T^{-1}(A))=\mu(A)$ for all $A \in \mathbb{B}_{X}$. We denote by $M(X,T)$ the space of all $T-$invariant measure which is a nonempty, compact and convex in weak* topology. Let $f:X \to \mathbb{R}$ be a continuous function. Denote $G(f)=\sup_{\mu \in M(X,T)} \int f d\mu$.
$\textbf{Question}:$ Why the supremum is always attained by a measure that belongs to the extreme set $M(X,T)$?
My attempt: I think that is related to the fact $M(X,T)$ is compact and convex in weak* topology, but I don't know why the measure must belong the extreme set $M(X,T)$?
First, you are right about the compactness. A continuous function over a (nonempty) compact set always obtains a maximum and a minimum. In this case, the set is compact in the weak-$*$ topology, and the function $$ h:C(X)\to\Bbb R,\qquad f\mapsto \int f\,\mathrm d\mu $$ is continuous in the weak-$*$ topology, so this fits together.
A hint for the extremal set:
Consider the subset of $M(X,T)$ where the maximum is obtained. This subset is again weak-$*$ compact and convex. Pick an extremal point of this subset (here you have to use Krein-Milman, to argue that such an extremal point exists). This should also be an extremal point of $M(X,T)$.