I am currently studying on logistic regression. So I have found a document on the Internet explaining about it.
Somehow, it explains Bernoulli distribution in the beginning and I am having a problem to understand the equation below. I can refer to the variance explanation in wikipedia, it is still not clear for me to understand. I am new to this, and reading the paper line by line. If you think you can give me an explanation, I will be really grateful.
I hope I have provided enough information for you to give me an explanation.
Thank you.

For the expected value, sum the values times the probabilities of the values: $$ \begin{align} \mathrm{E}[Y_i] &=\mathrm{P}[Y_i=0]\cdot0+\mathrm{P}[Y_i=1]\cdot1\\ &=(1-\pi_i)\cdot0+\pi_i\cdot1\\ &=\pi_i \end{align} $$ The variance is the mean of the squares minus the square of the mean. The mean of the squares is $$ \begin{align} \mathrm{E}[Y_i^2] &=\mathrm{P}[Y_i=0]\cdot0^2+\mathrm{P}[Y_i=1]\cdot1^2\\ &=(1-\pi_i)\cdot0+\pi_i\cdot1\\ &=\pi_i \end{align} $$ Therefore, $$ \begin{align} \mathrm{Var}[Y_i] &=\mathrm{E}[Y_i^2]-\mathrm{E}[Y_i]^2\\ &=\pi_i-\pi_i^2\\ &=\pi_i(1-\pi_i) \end{align} $$