Calculate a DFT of a simple finite signal {+1, −1, +1, . . .})
Computing the DFT sum

$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N},\qquad k=0,1,\ldots,N-1\tag{1}$$

directly can be tedious. A computer would generally use a Fast Fourier Transform (FFT) algorithm.

For the special class of exponential signals

$$x[n]=a^n,\qquad n=0,1,\ldots,N-1\tag{2}$$

$-$ and your example is a special case of Eq. $(2)$ $-$ you can find a closed-form expression for $X[k]$ by using the geometric sum formula. (Just be careful with those values of $k$ for which the denominator of that formula would become zero.)