Bertrand-equilibrium with discrete price set
The key is the definition of the Nash equilibrium solution concept that you are applying to solve your game. In non-formal terms, a Nash equilibrium is a set of strategies such that no player can increase his or her payoff by deviating to some alternative strategy.

Let's consider $\{30,30,30\}$. In this 'putative' equilibrium, firm A's profit is

$$\frac{D(p)}{3}(p-c)=\frac{20}{3}(30-20)=\frac{200}{3}&gt;0.$$

Could A do better with a lower price? A price of $p=10$ is less than his cost, so this obviously can't be better. Likewise, a price of $p=20$ yields profit

$$D(20)(p-c)=0,$$

which is less than the profit (200/3) in the putative equilibrium. So, again, a deviation to $p_A=20$ is not profitable.

Can A do better by deviating to $p_A&gt;30$? The answer is clearly no because any $p_A&gt;p_B,p_c=30$ implies that A attracts no demand and therefore earns zero profit.

We thus observe that A cannot find a profitable way to deviate from the putative equilibrium $\{30,30,30\}$, so this is indeed a Nash equilibrium.



To address your final question: there are two general approaches to problems of this type.


For each player in the game, compute their best response (i.e. profit-maximising strategy) to each possible combination of strategies by the other players. Then look for all situations in which every player is playing a best response; that is a Nash equilibrium.
Guess a set of strategies that you think might be an equilibrium. Then verify that is is indeed an equilibrium by checking that no player could do better by changing their strategy.