I pretty much agree with Jet Shield, but here's a few other things...
Re: Hiring someone whom is currently employed vs. not
Consider two prospective employees. They have the same qualifications, same years in industry, same education. But one is currently employed and the other has been out of work for six months. If you're a hiring manager, what do you do? Well, for one thing you know that whatever their qualifications, the guy that's out of a job did something to be out of a job. And whatever that something is, whether it's simply not being practically perfect in every way, working for the wrong company, or sleeping with the CEOs underage daughter, the hiring manager doesn't really expect to find out. The currently employed guy, on the otherhand, is still currently employed, aka, they haven't screwed up enough to get fired/downsized/whatever. Throw in that skills atrophy without constant use (I would raise a critical eye at any prospective computer programmer who hasn't programmed in a few years)...
As for the "but the economy!" and "they're making a hole in another company!"... sorry, but companies are selfish. They don't actually care that you "really need" a job, they don't care they're making a problem for someone else, they don't care about the larger picture, for the most part. They want the most qualified person (for the right price), and let the rest of the world burn.
Re: Advertising jobs they plan to fill internally
Well, that can be kinda complicated. Depending on what the organization it, it could be anything from "well, we want to fill it internally, but policy requires we advertise and consider all canidates, even our preferred one, in an equitable manner". It could be "we want to yank Steve's chain around some". It could be "I'd love to put you into that managerial position Steve, but I'm not allowed to fill positions, that's entirely in HR's hands" It could be lots of things. Most likely it's an attempt to give a fair shake at other qualified people so, while their intended candidate may enjoy some bias, they aren't guaranteed. After all, sometimes you get that motorcycle-riding alligator-wrestling Ph.D that cold-calls in response to a newspaper ad and they're just too awesome to not hire, so sorry Steve, maybe next time.
Re: Not hiring over-qualified candidates
Jet Shield got it pretty good. If someone is clearly over-qualified, then any hiring manager is gonna sit there and wonder if they're going to be right back in the same position in six months.
As a side note, this isn't conjecture. I've sat in on the hiring commitee at a quasi-public institution before (university library), and these were some of the things we talked about. We looked at the over-qualified candidates, discussed/projected/navel-gazed about their motivations and desires, dissected their current employment status vs. their work history, talked about internal posting vs. external posting, and so-on. Our situation was even more constrained because, due to HR policies, we weren't allowed to ask any candidate a question we didn't askof all the candidates, so we were hamstrung on getting answers to some of the things that concerned us about individual applicants.
Conclusion: two things to remember: the people hiring you are human, and they are selfish. Don't expect them to act perfectly logically (if that was a reasonable expectation we wouldn't have a Civil Rights Act, after all), do expect them to respond more from their "gut" and "feelings", and don't expect them to think of the larger picture outside their organization. They want what's good for them, not what's good for you.
Now, you may not like that this is how people think, and you may think they should think differently, but how does the phrase go... "If wishes were fishes, Mon Calamari would be running Rebel Command"