How long do you have to live in stage 4 cancer?

Quite variable. Stage IV cancer generally means that the cancer has spread from its organ of origin to other organs. How long you have to live depends on where the cancer originated. For example, stage IV breast or colon cancer is much more easily treated than stage IV pancreatic or gallbladder cancer. So you need additional information to fully answer your question.
Depends. Depending on the cancer and the response to chemotherapy, survival can be weeks to months or months to years. In some cases, responsive stage IV cancer is associated with long term survival.