I was given the following problem:
However, I am confused as to how they compute $E(X_i)$. From definition, $E(x)=\sum{xP(X=x)}$, so wouldn't the expected value of $Xi$ be the following instead:
$$E(X_i)=1*P(X_i=1) + 0*P(X_i = 0)$$
I am also not understanding how $P(X_i=1) =1$, wouldn't it equal p?

It's a definite typo in the book. It should read on both lines $$\dots1×P(X_i=1)+0×P(X_i=0)=P(X_i=1)=p\dots$$