Question:
There are N voters who have positions that can be indicated by the numbers 1 through 7. The number of voter with each position is indicated in the table below:
Assume that voters always vote for the candidate who’s position is closest to their own, and that there are two candidates. When they are indifferent the voters choose each candidate equally likely. Candidates only care about winning the election. For each position of candidate 2 find the best position (or positions) for candidate 1. And find Nash equilibrium.
Answer:
And the Nash equilibrium is $l_1=l_2=5$
I do not understand this answer. Please explain it more clearly. How they write these best responses? What is the logic behind it. And how they decide the Nash equilibrium is this? Thanks a lot.

To explain the notation: $BR$ presumably stands for "Best Response". Thus $BR_1(l_2)$ refers to the best response candidate $1$ has if candidate $2$ has announced position $l_2$. It often happens that several responses are equivalent, in which case $BR_1(l_2)$ includes all the optimal responses.
For instance, if candidate $2$ has taken $\#1$ then any response to the right of position $\#1$ captures a winning $13$ votes. Thus $BR_1(\#1)=\{2,3,4,5,6,7\}$
Should say, I don't agree with some of their table. For example, I think that $BR_1(\#7)=\{5,6\}$ or $\{4,5,6\}$ as any of those choices guarantees $16$ votes. To be clear, I am thinking of optimizing total vote count where they might only care about winning. Indeed, that's indicated in the problem, though why they exclude $\#6$ eludes me. And choosing $\#3$ is a poor idea, as it only guarantees $12$ votes. Candidate $2$ will claim the $9$ votes from supporters of $\#6$ and $\#7$ and then each of $\#5's$ voters will toss a coin, which could easily go against you. The way I read the rules, you'd have a $\frac {15}{16}$ chance of winning if you went with $\#3$ but a certainty of winning if you go with $\#4,\#5$ or $\#6$.
Similarly, I think that $BR_1(\#6)=\{5\}$
In any case, it is clear that $(\#5,\#5)$ is a Nash equilibrium. If $l_2=\#5$ then candidate $1$ loses $13$ to $12$ by moving to the left, and loses even more heaviliy by moving to the right. Thus neither side has an incentive to move.