Positive reason: One quality of good developers is that they seek out new knowledge and want to “grow”. At some point, even in a great company, you may run out of ways to do that and you need to move on in order to keep growing.
Negative reason: Employees want to feel valued. If the pay doesn’t keep up with what they are worth, they’re going to feel the need to move on. A counter offer may only confirm that there employer really did know how valuable they were but decided not to pay them for it - until faced with someone giving their notice.
In any job you must be given the opportunity to grow. The best employers will give you that chance over multiple dimensions: knowledge, wealth, reknown, responsibilities. Most employers will give you only one dimension. As long as you keep growing along that dimension all is well. But that single dimension gives a lot of leverage to your employer. He can use it to coerce you and force you back into line. When that happens, it’s time to go.
On the flip side I've managed teams in organisations that see rockstar developers as indispensable. The result is you get the smartest people doing the dumbest stuff for the company- working almost completely against the core goals of the organisation because management is too scared to say "We can't offer you the 'growth' opportunities you want right now"
Negative reason: Employees want to feel valued. If the pay doesn’t keep up with what they are worth, they’re going to feel the need to move on. A counter offer may only confirm that there employer really did know how valuable they were but decided not to pay them for it - until faced with someone giving their notice.