Help in proper notations and mathematical formulation
You observe a sequence $(s_1,\ldots, s_N)$ where random variables $S_k$ are i.i.d. and are drawn from a set (alphabet) $\mathcal{A} = \{a_1,\ldots, a_m\}$ with letter probabilities $P(a_i)=p_i$ for $1\leq i \leq m$ and $\sum_{i=1}^m p_i = 1$.

The likelihood function can be written as:

\begin{eqnarray*}
l( p_1,\ldots, p_m; s_1, \ldots, s_N ) &amp;=&amp; P( S_1 = s_1, \ldots, S_N = s_N ) \\
&amp;=&amp; \prod_{k=1}^N P(S_k = s_k) \\
&amp;=&amp; \prod_{k=1}^N \sum_{i=1}^m p_i \mathbf{1}\{s_k = a_i\}
\end{eqnarray*}
where $\mathbf{1}$ is the indicator function which evaluates to one when the condition is true, and zero otherwise.

In part 2 of your question, we need to change the random variable to letter counts instead of the sequence itself. Let $X_i$ be the number of times we observe letter $a_i$ for $1\leq i \leq m$ in our sequence of length $N$. Then $\{X_i\}_{i=1}^m$ has a multinomial distribution:

$$
P(X_1 = x_1,\ldots,X_m=x_m) = \frac{N!}{\prod_{i=1}^m x_i!} \prod_{i=1}^m p_i^{x_i}.
$$

(Convince yourself this is in fact the right probability mass function for letter counts; the argument involves some combinatorics.)

The log-likelihood function can be written as:

\begin{eqnarray*}
\log l(p_1,\ldots,p_m; x_1,\ldots, x_m) &amp;=&amp; \log P(X_1 = x_1, \ldots X_m = x_m) \\
&amp;=&amp; \log(N!) - \sum \log(x_i!) + \sum x_i \log p_i.
\end{eqnarray*}

The MLE of $p_i$ can be found by maximizing the log-likelihood. However, note that we have a constrained maximization problem here because we require $\sum p_i = 1$.

To convert this to an unconstrained maximization problem, let's introduce a Lagrange multiplier $\eta$. So the MLE of $p_i$ can be expressed as:

$$
\hat{p}_i = \arg \max _{p_i} \log(N!) - \sum \log(x_i!) + \sum x_i \log p_i + \eta \left( 1-\sum p_i \right).
$$

Setting the gradient of the objective function to zero gives:

$$
\frac{x_i}{p_i} - \eta = 0 \implies p_i = \frac{x_i}{\eta}.
$$

However, note that in order to meet the constraint, we must set $\eta = N$ (because $\sum x_i = N$).

This finally gives us the MLE:

$$
\hat{p}_i = \frac{x_i}{N}
$$

which can also be expressed as
$$
\hat{p}_i = \frac{ \sum_{k=1}^N \mathbf{1}\{s_k = a_i\} } {N}.
$$

This is intuitively pleasing! To get the ML estimate of $p_i$ count the number of times you see the letter $a_i$ in your original sequence and divide that by $N$.