How to solve definite integral in range of complex number, such as $ \int_{-1-i}^{1+i} (1) dx $? [duplicate]

For a very brief summary: complex integrals are like line integrals in the plane, and usually are path-dependent. To integrate along a specific line or curve in the complex plane, parametrise the curve (that is, express it in terms of a real parameter) then substitute.

However (and this is still only true in summary), if a function is analytic in a domain $D$, then its integral along any path within $D$ is independent of path: that is, it only depends on the endpoints and not on the specific path. Moreover, the integral can be calculated as for real integrals: find an antiderivative and then evaluate the change from the beginning to the end of the path.

In your first example, the integrand is analytic everywhere and so it is just like finding a real integral of $(x^3-x)e^{x^2/2}$.

For your second example, the integrand fails to be analytic along the negative part of the real axis (including $0$). Since the specified path, a straight line from $1$ to $i$, does not intersect this region, you can (with care) use the same approach.

Your third example is actually posed ambiguously because it does not specify whether the path is a clockwise quarter circle or an anticlockwise three-quarter circle. Since the integrand has a singularity inside the unit circle it will make a difference.

Note that if the specific path is given you can always in principle use the parametrisation approach, though it may involve a good deal more work than the antiderivative method (where the latter is applicable).

There is plenty more to be said but probably not within an answer of sensible length ;-)