To solve the integral, we note that it is an even function due to the symmetric limits and the even nature of \( \cos(\alpha x) \). Therefore, we can simplify by doubling the integral from 0 to 1:
\[ \int_{-1}^1 \frac{\cos \alpha x}{1 + 3^x} \, dx = 2 \int_0^1 \frac{\cos \alpha x}{1 + 3^x} \, dx. \]
Given that the value of this integral equals \( \frac{2}{\pi} \), we proceed by testing values of \( \alpha \) to match this result.
Through evaluation, it turns out that setting \( \alpha = \frac{\pi}{2} \) satisfies this condition, yielding:
\[ \int_{-1}^1 \frac{\cos \left( \frac{\pi}{2} x \right)}{1 + 3^x} \, dx = \frac{\pi}{2}. \]
Therefore, the value of \( \alpha \) is \( \frac{\pi}{2} \).