Brace yourself, Math ahead !
The likelihood is defined to be the probability to observed your data under a given parameters : $P(Y_1,...,Y_n|\theta)$
Let's consider that all event are iid:
$P(Y_1,...,Y_n|\theta) = \prod_1^n{P(Y_i|\theta})$
Now let's split the case where $Y_i = r+1$ from the rest:
$P(Y_1,...,Y_n|\theta) = \prod_{Y_i<r+1}{P(Y_i|\theta}) * \prod_{Y_i=r+1}{P(Y_i|\theta})$
Now we know the expression of the probability for both of these product:
$P(Y_1,...,Y_n|\theta) = \prod_{Y_i<r+1}{P(X=Y_i|\theta)} * \prod_{Y_i=r+1}{P(X>=Y_i|\theta)}$
$P(Y_1,...,Y_n|\theta) = \prod_{Y_i<r+1}{(\theta^{Y_i-1}*(1-\theta))} * \prod_{Y_i=r+1}{\theta^{Y_i-1}}$
$P(Y_1,...,Y_n|\theta) = \prod_{Y_i<r+1}{(\theta^{Y_i-1}*(1-\theta))} * \prod_{Y_i=r+1}{\theta^{r}}$
$P(Y_1,...,Y_n|\theta) = \prod_{Y_i<r+1}{(\theta^{Y_i-1}})*(1-\theta)^{n-M} * \theta^{M*r}$
From Now on it is easier to take the log : $L(\theta) = log(P(Y_1,...,Y_n|\theta))$
$L(\theta) = \sum_{Y_i<r+1}[(Y_i-1)*log(\theta)]+(n-M)*log(1-\theta) + M*r*log(\theta)$
$L(\theta) = log(\theta) * [\sum_{Y_i<r+1}Y_i - \sum_{Y_i<r+1}[1]] +(n-M)*log(1-\theta)+ M*r*log(\theta)$
$L(\theta) = log(\theta) * [\sum_{Y_i<r+1}Y_i - (n-M)] +(n-M)*log(1-\theta)+ M*r*log(\theta)$
Now we take the derivative with respect to $\theta$:
$L'(\theta) = \frac{\sum_{Y_i<r+1}Y_i - (n-M)}{\theta} -\frac{n-M}{1-\theta} + \frac{M*r}{\theta}$
We then look for $\theta$ such that $L'(\theta)=0$
$\frac{\sum_{Y_i<r+1}Y_i - (n-M)}{\theta} -\frac{n-M}{1-\theta} + \frac{M*r}{\theta} = 0$
$\frac{\sum_{Y_i<r+1}Y_i - (n-M)}{\theta} + \frac{M*r}{\theta} = \frac{n-M}{1-\theta}$
$\frac{1-\theta}{\theta} = \frac{n-M}{M*r+\sum_{Y_i<r+1}Y_i - (n-M)}$
$\frac{1-\theta}{\theta} = \frac{n-M}{M*(r+1)+\sum_{Y_i<r+1}Y_i - n}$
$\frac{1-\theta}{\theta} = \frac{n-M}{\sum_{Y_i=r+1}Y_i+\sum_{Y_i<r+1}Y_i - n}$
$\frac{1-\theta}{\theta} = \frac{n-M}{\sum_{1}^nY_i - n}$
$\frac{1-\theta}{\theta} = \frac{n-M}{\sum_{1}^nY_i - n}$
$\frac{1}{\theta} = \frac{n-M}{\sum_{1}^nY_i - n} + 1$
$\frac{1}{\theta} = \frac{n-M+\sum_{1}^nY_i - n}{\sum_{1}^nY_i - n}$
$\frac{1}{\theta} = \frac{\sum_{1}^nY_i - M}{\sum_{1}^nY_i - n}$
$\theta = \frac{\sum_{1}^nY_i - n}{\sum_{1}^nY_i - M}$
Done !