I saw a question on /. this morning about exactly this and decided to blog it rather than comment as it's another one of those "I hear this question all the time" posts.
The question's usually along the lines of, "I'm really good at my job. How come I can't get promoted?"
The simple-yet-offensive answer is this: you haven't done a good enough job to be promoted.
Before everyone starts screaming, let's look at this from the perspective of a mythical manager who actually wants his/her employees to succeed. I know, I know, but they really are out there. So... what goes on?
Usually the internal monologue goes something like this:
John's doing a really good job running X/Y/X.
I like John and want to promote him.
There's a position running a new project and I'd really like to offer it to him.
I have nobody to replace him with and would need to train a replacement.
Oops. John's just made it impossible for even the best-intentioned manager to promote him. Now imagine what a less-well-intentioned one would do.
At any one of these stages a promotion is easily killable. If John isn't doing a really good job running X/Y/ then there's no way that he's going to be promoted except under the Dilbert Principle. Similarly, if John isn't well-liked then there's no way he's going to get promoted simply because dealing with unpleasant people is unpleasant and a good manager isn't going to inflict an unpleasant person on other people if he/she can at all avoid it. The third one's obvious: if there's no promotion available then there's no promotion available.
The fourth point, though, is the one that almost invariably gets forgotten. I've blogged about this before but the gist of it is that if John's made himself indispensible then that's the end of it. Indispensible means that he cannot be done without; in other words, he's locked himself into his current position all by himself. John hasn't done a good enough job to get promoted because he hasn't trained his own replacement.
Training your replacement is part of your job.
So why don't people do it?
The most obvious answer is fear. Fear of being replaced by someone younger and cheaper; fear of being shown up by someone who ends up knowing more than you; fear that your management won't see this as a valuable use of your time. There's also fear of the unknown - it's much easier in many cases to perennially gripe about being really good but not getting promoted than it is to actually get promoted and run the risk of failing in your new position.
There are other likely culprits (budgetary constraints, time pressure etc.) but the point of this article is that they're all surmountable once the fear is overcome.
I want a promotion. Should I stay in my current company or look elsewhere?
The short answer to this is: go wherever your interests take you.
The longer answer: if you like your company and want a particular position, ask for it. It's much easier to just tell people what you want and ask what you need to do in order to get it. You never know - they might not have realised that you're bored or unhappy where you are, especially if you're keeping things running smoothly and appear to have it all under control.
If your current company can't or won't accommodate you then, by all means, look elsewhere. Before doing that, though, take a good, hard, honest look at yourself and ask whether you'd promote you if you ran the company. If the answer's yes but the company won't then it's time to move on. If the answer's no then it's probably time to ask for help - and also to start making some serious efforts towards your own professional development.