Taylor's theorem says that every function $f(x)$ that has $n$ derivatives in some neighborhood of point $x_0$, is equal to the series (for every $x$ in that neighborhood)
$$f(x) = \sum_{n=0}^{n-1} \frac{f^n(x_0)}{n!}(x-x_0)^n + R_n(x)$$
Where $R_n$ is the remainder,
$$
R_n(x) = \frac{(x-x_0)^{n}}{n!}f^{(n)}(\xi),
$$
Where $\xi$ is some number between $x_0$ and $x$. Note that this remainder term is the just the generalization of the Lagrange mean value theorem, i.e. for n=1,
$$
f(x) = f(x_0) + (x-x_0)f'(\xi)
$$
Now if you let $n \to \infty$, the function will be equal to the infinite series (in a neighborhood of $x_0$)
$$
\sum_{n=0}^{\infty} \frac{f^n(x_0)}{n!}(x-x_0)^n
$$
Only if a neighborhood of point $x_0$ exists, such that for all x in that neighborhood the remainder term tends to zero
$$
\lim_{n \to \infty}R_n(x) = 0
$$
If this condition is satisfied the function is analytic at $x_0$.
You can easily prove that the remainder tends to zero if you can bound every derivative of your function, this is true for the sine function for example, for all $n$
$$
|\sin (x)^{(n)}| \leq 1 \Rightarrow \lim_{n \to \infty}\frac{(x-x_0)^{n}}{n!}|\sin (\xi)^{(n)}| \leq \lim_{n \to \infty}\frac{(x-x_0)^{n}}{n!} = 0
$$
Thus $\sin$ is an analytic function.