Using double quotes
Use double quotes to make the shell expand variables while preserving whitespace:
sed -i "s/$var1/ZZ/g" "$file"
When you require the quote character in the replacement string, you have to precede it with a backslash which will be interpreted by the shell. In the following example, the string quote me will be replaced by "quote me" (the character & is interpreted by sed):
sed -i "s/quote me/\"&\"/" "$file"
Using single quotes
If you've a lot shell meta-characters, consider using single quotes for the pattern, and double quotes for the variable:
sed -i 's,'"$pattern"',Say hurrah to &: \0/,' "$file"