Quotation marks are used to identify direct speech, to indicate a special word or phrase, and to indicate titles of short stories, poems, and television shows. They come in two varieties: single and double. American English and British English differ in their preference for using the single or double variety, but the essence of how the quotation marks are used is the same on both sides of the pond.
Let's talk about using quotation marks to indicate direct speech. For fiction writers this is pretty straightfoward: you use quotation marks when your characters are speaking to show that they're saying something and it's not just you narrating. It's pretty much the same for academic and nonfiction writing, although the quotation marks may indicate a passage of text that is being copied from another writer's work as well as speech. But the quotation marks indicate that it's not the writer, but another person (fictional or real) whose words are being shown.
The preference for the single and double quotation marks is largely a matter of style. American writers will use double quotation marks to enclose their dialogue, while British writers will use the single quotes. Here's an example of quotation marks used to indicate direct speech:
American: "Hey, Frank, take a look at this huge rattlesnake." British: 'Oy, Doctor, you're not leaving in the Tardis without me.'
Writers sometimes break up a piece of dialogue with description. The usage of single and double quotes is the same as a regular unbroken sentence, but notice the different placement of the comma in the first part of the quotations:
American: "I'm leaving now," said Jack, "and I want to watch TV when I get home." British: 'Please put the broom away', said Amy, 'when you are done with it.'
It gets a little bit more complicated when you have dialogue within dialogue. The basic rule is to alternate your usage of single and double quotation marks, one inside the other. You'll rarely need more than two levels of quotation marks, but if you do, just keep swapping them back and forth. If you use the American style and put double quotation marks around speech, use the single variety for speech within speech. If you use the British style of single quotation marks, use the double variety inside. Take a look at this example:
American: "Linda said, 'You won't believe what happened at work today,' and I didn't." British: 'I was just sitting down for lunch when someone yelled "Fire!" '
Take a look at the second example, and you'll see that I put a space between the double and single quote at the end of the sentence. I've done that to make it easier for you to see the order of the punctuation, because without the space it would be hard to distinguish the single and double quotes. Good typographers sometimes put small amounts of space, called a thin space, between the sets of quotation marks to make it a little easier for the reader to see them.
Quotation marks can also be used to highlight a word or phrase that's being discussed. Sometimes this is just something like a new term, but it can also show that the reader is being facetious or doesn't really believe what he's quoting. In that case it's called a "scare quote," and the quotation marks indicate disbelief or even snarkiness. British and American styles use the same marks they'd use for a regular quotation.
American: My new teacher "loves" my handwriting. British: The 'new and improved' detergent didn't clean my clothes.
American and British styles differ in whether commas and other punctuation are placed inside or outside of quotation marks. Americans place the comma and period inside the quotation marks whether they're single or double, but the colon and semicolon follow the closing quotation marks. Question marks and exclamation marks may be inside or out, depending on whether they're part of the quotation. The British place punctuation that is part of the quote within the quotation marks, including the exclamation mark and question mark.
Find a good style manual and use it. For Americans, The Chicago Manual of Style (both print and online) and Purdue University's Online Writing Lab are good resources. For Brits, the University of Oxford has an online style guide, as do the BBC and The Economist, among others. Canadian writers typically follow American usage—but not always—while Australians and other post-colonial users of English will generally follow British usage.
Bear in mind that styles are flexible, and some publishers will have their own way of doing things. Pick one style for your writing and be consistent with your use of it. If your publisher wants to do something else it will be easier for them to do a search-and-replace to make their changes.