Typically when applying for jobs, a firm wants you to submit a resume and cover letter. However, most employers won't even bother reading your cover letter.
So why bother writing one?
Well, the cover letter really only comes into play if your resume is a match for what the position entails and the employer's interest in you has piqued. Once you've made it through that hurdle, the cover letter is used to further weed out unqualified candidates.
How can you make sure your cover letter lands you an interview and not in the trash bin?
Do some research and find out which person reviews the resumes and send it to that person. Writing "To Whom It May Concern", "Dear Sir or Madam" and "Dear Hiring Manager", automatically give the impression that you couldn't be bothered to put in the effort to find the right person to address it to. It also gives the impression that you don't really want THIS job, and that any job will do.
Don't be cliche
Don't begin the letter with "I am writing to express my interest in the ABC position." The hiring manager already knows you're interested in applying, no need to state the obvious. Use the opener to state something about yourself or something in the job description that drew you to the position. It should be something that draws the hiring manager in and makes them want to keep reading.
Your cover letter is not the place to simply recite what's in your resume or give a laundry list of all of your skills. Employers don't want to read that you're hardworking, they want examples of when you went above and beyond to get the job done. Review the job description and based on what they're looking for, give examples of how you match that.
Remember it's not about you
Your job is to sell the firm on why you should be hired over every other applicant. This does not mean that you discuss what you hope to get out of the position. No one cares what you want out of the position. At least not at first anyway. An employer wants to know that you understand their firm, the industry, and that you will make a positive addition to the workplace. Demonstrate that you understand their pain points and that you have the solution.
Make sure your cover letter stands out from the sea of canned letters. Put in the time to really wow the hiring manager. The devil is in the details.