Despite online applications for jobs being increasingly common, employers still occasionally expect a cover letter to accompany your C.V. In particular, this is likely if:
You are applying to a Small or Medium Enterprise (SME) - for instance, a tech start-up.
You are speculatively writing to enquire whether or not a job is available.
Basic Points
English, spelling, and punctuation are essential. Consider that you are a computer scientist - you know that a badly placed fullstop or semi-colon in code can make the difference between working code and a wasted five hours of debugging. Why should any company hire your services to write Java or C if you can't debug basic English?
The world doesn't owe you a living. Enthusiasm is good, but the main point of the letter isn't to explain why this job will benefit you. Make sure to explain what benefits you'll bring to the company - in terms of technical skills, abilities, and values. This isn't to say that you shouldn't be enthusiastic - in some sectors this is essential (notably the games industry).
Avoid passive constructions, cliches, slang, and jargon for jargon's sake.
Make sure both your CV and letter have your contact details: name, address, phone number, and email. Don't make it hard for anybody to give you a job.
Don't simply repeat the content of your CV. Where possible, focus on specific abilities you have that make you the perfect candidate for this particular job. Don't repeat phrases found in your CV (especially your personal statement). If a recruiter mentions specific skills required, then explicitly state you have these (as long as you do).
Do not write more than a page and don't waffle. Any recruiter will give you a limited amount of time/attention. Don't waste it.
More Details
You need to sell yourself. However, every claim you make needs to be evidence-based. In the CV world, every candidate is a natural-born leader with excellent communication skills, who is independent and proactive, but also works well in a team. Hopefully by now you've realised that this isn't reality. No recruiter is impressed by such claims. If you wish to claim something, then provide an example of when you demonstrated a skill. This can be technical - claiming to be a great programmer means you should have code available (hosted on github for instance) or softskills - claiming you have great communication skills means you should have done something which requires this (even if it's being in a debating team).
You need softskills such as teamwork, communication, time management, etc. Possibly a long time ago you could survive in the IT industry as a lone geek who was left alone to write code. This is no longer the case: most development is done in teams, and if you cannot explain the code you write, then it's less than useless since somebody else is one day going to need to debug it.
You might not have such skills now. That's okay - hopefully you're still at university, and universities are a great place to development such things and not just in your studies. There are a lot of opportunities - student competitions (e.g., hackathons) and relevant jobs. The Guild is also very useful - if you can claim that you've ran a student society (regardless of what it was about) then you can probably justify a whole range of useful social skills (such as the ability to herd cats).
4. Some technical jobs will require specific skills, and often a company will hire a recruitment agency to sift through applications. Therefore, if you apply for a job as a Scala programmer, then you need to explicitly list these skills on your CV and cover letter. Don't leave it up to the reader to guess this: the recruitment agent probably doesn't know what Scala is.