@OP: This is how you can *escape* a single quote inside single quotes in bash:
Strictly speaking you are not really escaping it inside single quotes. You simply close the quotes, escape it in bash and then reopen the quote.
Alternatively, you can put your sed commands inside double-quotes. Then you do not have to escape the single quote:
As for your second issue, try putting a backslash '\' after the 'i':
sed 'linenumber i\whatever' file