I think I understand maximum likelihood, but I feel like there is an inconsistency here that I'm missing.
For example, assume we're talking about coin flips, and we'll let p = probability of seeing a head, then to see the result [HHT] means that I'm calculating:
L = (p^2) * (1-p) = p^2 - p^3
Maximizing gives:
L=2p - 3p^2 = 0
Which means that p=2/3 which is good.
Now assume that all my observations were heads [HH]. This means that my likelihood function is now:
L=p^2
Maximizing/Solving this means that p=0. Likewise, if I had said all my observations were tails [TT], then my likelihood function is:
L=(1-p)^2
Maximizing/Solving this means that p=1.
But isn't the results reversed? I would expected that seeing HH would give me p=1.
Note that $L'(p)=0$ for a particular $p$ does not mean that $L$ achieves its maximum there: It can be a local minimum of the function. In your case, $L(p)=p^2$ achieves its minimum at $p=0$. You can verify that by computing $L''(p)=2 > 0$.