I'm not 100% with terms in English, so maybe I'm missing something.
When applying for a job, what is the difference between a resume and a cover letter?
Some companies ask for one or the other, some ask for both. What should be written in each?
A resume usually is an overall summary of your background and experience. It often lists your education, your former jobs, and your areas of expertise. You often use the same resume for every job you apply to, but some customize the resume a bit for specific jobs.
A cover letter is a letter you write to introduce yourself to a particular hiring manager. Often, you try to highlight how you fit that specific job.
In addition to what Joe Strazzere said, your cover letter is your chance to actually address anything that your resume doesn't.
This could include the following:
Really anything that you feel is necessary. Try to keep it to a few paragraphs though, there's definitely a sweet spot when it comes to length.