Given $$G(z) = \int_{1+i}^{z}\text{sin} (\theta^2) d\theta$$
Prove that $G(z)$ is an analytic function of $z$.
I read that integration preserves analyticity. But why is that true when $z$ is in the integral bounds? What if the function is something different instead of $\text{sin}(\theta^2)$, say $f(z)$ which is only analytic in a certain region $R$ and I integrate along a path that goes outside $R$?
You are asking about one of the standard theorems in complex analysis.
This theorem is step in proving Morera's theorem. For proof see Rudin's Real and Complex Analysis chapter 10: proof of 10.14 (what you are interested in), and statements of 10.6 and 10.16 (holomorphic functions are exactly the ones representable by power series).