Software engineers are in very high demand in today's job market—so much so that, if you're really at the top of your game, you can aspire to getting hired on at Tesla, reporting directly to Elon Musk. In November 2015, the Tesla CEO advertised openings for "hardcore" software engineers to help program Tesla's driverless cars. Musk tweeted that he would personally interview candidates, and these positions would report directly to him. 
Even if you aren't the one software engineer in a hundred thousand who gets hired to report to the CEO of Tesla, if you're good at what you do, you probably have the leverage you need to negotiate a higher salary with your current boss.
Do Your Homework First
Start with some research to find out what kind of compensation you might earn elsewhere. To save you some time, here's a little research on salaries in the United States: PayScale Human Capital collected data from 35,059 individuals and concluded that as of September 2015 the average annual salary of software engineers in the United States is $80,140. 
The PayScale Human Capital survey found that Facebook, Google, and Apple offered the best pay packages for software engineers, followed by Microsoft and Amazon. It's worth noting that the Facebook, Google, and Apple development sites are primarily located in Silicon Valley, where the pay for software engineers is the highest in the United States; Microsoft and Amazon do most of their development around Seattle, where the pay for software engineers is second highest in the country. Salaries in Silicon Valley are up to 48% above the national average (in Mountain View); salaries in Seattle are 22% above the national average.
The same survey indicates that entry-level software engineers make around 9% less than the average pay, and those with more than 20 years of experience make around 33% more than the average.
Understanding this kind of research detail will help you to set appropriate objectives, since knowing what other people are getting paid allows you to calibrate your expectations with the realities of the general market. But you should also factor in your alternatives. If another company has made you a job offer that exceeds what you're currently getting, you have a stronger hand. If you can get Elon Musk to offer you a job, that should certainly increase your value at your current company!
You should also take into account how much your employer needs you. Think about what you've achieved so far in your job, focusing first on accomplishments that can be measured. Have you written more bug-free software than your colleagues? Are your modules used by more application teams than the modules written by other engineers? Do you finish projects on time more often than your colleagues do?
Think also about the more "fuzzy" qualities that aren't easily measurable, but are observable by other people in your organization. Do you have a reputation for understanding requirements better than your colleagues do? Perhaps you're recognized as a leader within the organization. Maybe people generally comment on your good attitude, or you're known as a solid team player who brings out the best in other people.
Your value to your employer isn't just based on what you've done in the past. Think also about what you can do in the future—how uniquely qualified you are to perform some of the tasks that will be important to your company. You may be better at developing certain algorithms that are sure to be essential in the future. Or you may be highly skilled at a programming language your company will be using for key projects.
Finally, consider your employer's alternatives. Are you the only engineer who knows UNIX and can program in C? Do you understand Python better than anybody else does? Are you living someplace that has very few other software engineers of your caliber?
As you're setting your objectives, write down your arguments, so that you can back up your position with hard facts. Knowing salary ranges, your measurable qualities, your reputation, your value for future projects, your alternatives, and your company's alternatives will all help you in supporting your position.
Four Rules for Conducting Successful Salary Negotiations
Once you've done all your homework, you're almost ready to ask for a raise. Before you rush out of the starting gate, however, make sure that you thoroughly understand these four rules for negotiating with your employer.
Rule 1: Maintain Your Relationship with Your Employer
At minimum, try to maintain the status quo. Better yet, work to improve your relationship through the negotiation. The best outcome is that your company agrees to your requests and values you more highly. Your victory will be hollow if you keep your job but your employer holds a grudge because of the way you asked for the raise.
If you show respect for your employer and back up your requests with facts, you're likely to improve the relationship. Remember that even if you don't get what you want, you must continue to show respect for your employer. If you stay on with the company, you definitely want to maintain a good relationship; and if you leave the company, you want to stay on good terms, because you may run into former colleagues in a future job.
Rule 2: Choose the Right Time to Ask for a Raise
When you ask someone for something, timing is critical. Try to do something good for your employer before you come in with demands. If your relationship is at a high point, your chances of getting what you want improve considerably.
Rule 3: Give the Other Person Time to Reply
After you ask for something, wait patiently for a response. If you get nervous and follow your own demand with a new demand, it shows that you weren't convinced that your original demand was fair.
Rule 4: If You Receive a Counteroffer, Pause Before Accepting
Even if Elon Musk calls and offers you a million dollars to work on his driverless cars, wait at least 30 seconds before you respond. If you accept too fast, Mr. Musk might think he could have gotten a better deal.
This point is especially important when you're negotiating a raise. If all goes well, you will continue to have a long-term relationship with your employer. The last thing you want is to leave the negotiator with the feeling that you got the better end of the deal.
By waiting a little while before agreeing to an offer, you also set yourself up as somebody who won't accept just anything. Chances are, you'll negotiate again with that person sometime in the future. Send signals that will give you a better bargaining position next time around.
It's not easy to ask for a raise. But, as a software engineer, you deserve to be paid well for good work. Don't be shy about asking for more money from time to time. And always be on the lookout for other jobs. Nobody in your company will be upset with you if other companies find you desirable.
 Elon Musk's tweet for "hardcore" software engineers, November 19, 2015.
 PayScale Human Capital statistics on salaries for software engineers. Retrieved December 18, 2015.