James is correct, but to add some more data, I think that the best way to think about it is as arguments to the command: do you intend "hello" and "world" to be two arguments or "hello world" to be one argument.
Also, doublequotes allow interpretation of more than just variables. Exactly what depends on your shell, but check into history expansion, brace expansion, and filename expansion.
It's also important to note that there are some instances where you need to use both types of quotes in a single argument. Remember that (by default) arguments are delimited by whitespace, so if you don't leave any space, you're still specifying the same argument.
Most shells' singlequote mechanism doesn't allow for any special characters, which means that any instance of another singlequote, even if it appears to be escaped, ends the quote. It is therefore impossible to pass a string with a singlequote inside a singlequoted string, and you have to use doublequotes. This can be a pain when you want to pass an argument that contains singlequotes and something that would be interpreted, but you don't want to be. For example, if you wanted to pass the literal string '$VAR' is a variable
, you have to do it this way:
"'"'$VAR'"' is a variable"
That's actually a concatenation of three quote-escaped strings:
"'"
'$VAR'
"' is a variable"
Or, with the quotes removed:
'
$VAR
' is a variable
Actually, with most shells, you could also do it this way:
"'\$VAR' is a variable"
... where the backslash ("\
") tells the shell to accept the following character literally and not do any expansion on it.
But there are some instances where you end up having to do it the multi-string-concatenation way, not that I can actually come up with an example right now.