Expected number of unpecked chicks - NYT article In this article, the winner of the math competition answered this question correctly: 


  In a barn, 100 chicks sit peacefully in a circle. Suddenly, each chick randomly pecks the chick immediately to its left or right. What is the expected number of unpecked chicks?


The answer was given as 25. I am interested to know the correct method for solving this problem as well as a general way to find this out for N chicks. I was thinking of trying to solve by figuring out the number of occurrences of (something?) inside a binary string of length 100 (or N), but I don't know if that is the right way to approach it.
For any individual chick, there is a $0.5$ chance that the one on its right won't peck it, and a $0.5$ chance that the one on its left won't peck it. So overall, it has a $0.25$ chance of not being pecked.

Since this is true for every chick, we can add up $0.25(100)=25$ to get the number of unpecked chicks.

"But wait," you might say, "the probabilities that chicks are unpecked aren't independent! If chick $n$ is unpecked, then chicks $n-2$ and $n+2$ will be pecked. Surely we have to take this into account!"

Fortunately, there's a very useful theorem called linearity of expectation. This tells us that for any random variables $X$ and $Y$, independent or not, $E[X+Y]=E[X]+E[Y]$, where $E$ is the expected value. What we're formally doing above is assigning a random variable $X_i$ to the $i$th chick that is equal to $0$ if the chick is pecked and $1$ if it's unpecked. Then the total number of unpecked chickens is $\sum X_i$, so the expected number of unpecked chickens is
$$E\left[\sum X_i\right]=\sum E[X_i]$$
by linearity of expectation. But $E[X_i]$ is just the probability that the $i$th chicken is unpecked, thus justifying our reasoning above.
Represent chickens as variables ($a_{1}, a_{2}, \dots, a_{100})$. Assign it a $1$ if unpecked, $0$ otherwise. We want to find the expected value of the sum $a_{1} + \dots + a_{100}$. Notice that the expected value of each of these is $\frac{1}{4}$, so by linearity of expectation, the expected value of the sum is $100 \cdot \frac{1}{4} = 25$