\[ L = \prod_{i=1}^n p^{X_i}\ (1-p) ^{1-X_i} \tag{1} \]
\[ \log L = \sum_{i=1}^n X_i \log p + \sum_{i=1}^n (1-X_i)\log(1-p) \tag{2} \]
\[ \frac{\partial\log L}{\partial p} = \frac{1}{p} \sum_{i=1}^n X_i - \frac{1}{1-p} \sum_{i=1}^n (1-X_i) = 0 \]
\[ \hat{p} = \frac{\displaystyle \sum_{i=1}^n X_i}{\displaystyle \sum_{i=1}^n 1} = \frac{\displaystyle \sum_{i=1}^n X_i}{n} = \bar{X} \]