You know that scene in movies where an employee has decided "Today's the day I finally ask for that raise"? If you're smart, that's not the way to plan it. Decide when to ask for a raise based on the company's schedule. Photo by Evan Jackson.
As reddit user drhorn points out, most companies have some kind of schedule for when they dole out raises. Usually it's around the time of a yearly evaluation. Under most circumstances, this is the best time to ask for a raise because all the moving parts to actually get you that raise are already in motion. Kickstarting that process six months ahead of time means a lot more work for your higher ups:
Unless you are the CEO, arguing for an employee to get a raise or promotion (especially off-schedule ones) takes valuable resources for a manager. It's not like you can go into your boss' office and just get one done on the spot. Most companies are going to require multiple layers of red tape to get there, and in general, will require you spending some of your probably limited "goodwill" budget on it...
That means that if you are someone who wants a 3% raise off-schedule, it's not going to happen. Not because you aren't worth the 3%, and not because 3% is a lot of money to the company, but because the level of effort required to get you that 3% raise is not proportional to the probability that you will leave if you do not get a 3% raise.
If you want to ask for a raise off schedule, weight it against the factors that make it worthwhile: do you have a backup offer from another company you can use as leverage? Does your boss value you enough to fight through extra red tape to keep you? Is your company agile enough to even push through a raise off schedule? Some huge companies may have deeply entrenched plans that can't be altered except under extreme circumstances.
In many cases, you may deserve a raise, but the timing is what kills your chances. If you just want a little pay boost because you feel you deserve it, it may be worth waiting until your usual review time. If you want a higher position with better pay and you're willing to leave the company to get it, asking immediately may be better. Check out drhorn's post below for more tips on negotiating a salary from a manager's perspective.