First of all, do not tell me to use Taylor. Using Taylor expansion is fine when you can symbolically calculate the derivatives. But thst's not always possible.
Given a generating function $g(x)$, how do I numerically calculate the nth coefficient with contour integration? I know nothing algebraic about this function, so I can't use tricks like partial fraction decomposition or Cauchy's residue theorem. I only know the numerical value of $g (x) $ given a real/complex number $x $. How do I choose the correct contour?
So $g(z)=\sum_{n\geq 0}a_n z^n$ is known numerically for complex $z$ and you would like to determine each $a_n$. This can be done by fixing any counterclockwise contour $C$ surrounding the origin. Then $$ \oint_C \frac{g(z)}{z^{n+1}}\ dz=\oint_C \frac{a_n}{z}\ dz=2\pi i a_n, $$ by the Residue Theorem. Choosing the contour is up to you, depending on the properties of your function (i.e., if you have a better numerical calculation in a certain region then choose a contour passing through that region). Otherwise, just take $C$ to be a circle of radius $r$ about the origin, in which case you can compute the integral as follows: $$ a_n=\frac{1}{2\pi i}\oint_C \frac{g(z)}{z^{n+1}}\ dz=\frac{1}{2\pi}\int_0^{2\pi}g\!\left(re^{i \theta}\right)r^{-n}e^{-i n\theta}\ d\theta, $$ and again in the absence of further information, taking $r=1$ would be the simplest choice.