Consider first the finite product
$$\prod_{i = 1}^n (1+x^i).$$
If you expand it, you get
$$\prod_{i = 1}^n (1+x^i) = \sum_{\varepsilon \in \{0,\,1\}^n} x^{\sum_{i=1}^n \varepsilon_i \cdot i}.$$
The term $x^k$ occurs as many times in that sum, as there are ways to write $k$ as a sum of distinct positive integers $\leqslant n$.
For $k \leqslant n$, the coefficient doesn't change anymore when you multiply further factors $(1+x^i),\, i > n$.
Perhaps expanding the product in full for $n = 4$ helps a little:
$$\begin{align}
(1+&x)(1+x^2)(1+x^3)(1+x^4)\\
&= 1\cdot 1\cdot 1 \cdot 1 + 1\cdot 1\cdot 1\cdot x^4 + 1\cdot 1 \cdot x^3 \cdot 1 + 1\cdot 1 \cdot x^3 \cdot x^4\\
&\;+ 1\cdot x^2 \cdot 1\cdot 1 + 1\cdot x^2\cdot 1\cdot x^4 + 1\cdot x^2 \cdot x^3 \cdot 1 + 1\cdot x^2 \cdot x^3 \cdot x^4\\
&\;+ x^1\cdot 1\cdot 1 \cdot 1 + x^1\cdot 1\cdot 1\cdot x^4 + x^1\cdot 1 \cdot x^3 \cdot 1 + x^1\cdot 1 \cdot x^3 \cdot x^4\\
&\;+ x^1\cdot x^2 \cdot 1\cdot 1 + x^1\cdot x^2\cdot 1\cdot x^4 + x^1\cdot x^2 \cdot x^3 \cdot 1 + x^1\cdot x^2 \cdot x^3 \cdot x^4\\
&= 1 + x^4 + x^3 + x^7\\
&\; + x^2 + x^6 + x^5 + x^9\\
&\;+ x^1 + x^5 + x^4 + x^8\\
&\;+ x^3 + x^7 + x^6 + x^{10}\\
&= 1\cdot x^0 + 1\cdot x^1 + 1\cdot x^2 + 2\cdot x^3 + 2\cdot x^4 + 2\cdot x^5 + 2\cdot x^6 + 2\cdot x^7 + 1\cdot x^8 + 1\cdot x^9 + 1\cdot x^{10}.
\end{align}$$
From each factor, we can choose either the $1 (= x^0)$ or the $x^i$ term. That gives $2^n$ products in total. Then we group these products by the resulting exponent of $x$.
Each of the $2^n$ products corresponds to one partition of an exponent into a sum of distinct positive integers, and each partition of $k$ into a sum of distinct positive integers $\leqslant n$ corresponds to one choice of the $x^0$ or the $x^i$ term of each factor.
For the sake of completeness here is a slightly different approach to part one, which then continues along the path in the link from Brian Scott.
The generating function of the set of partitions by the number of parts is given by
$$ G(z,u) = \prod_{k\ge 1} \frac{1}{1-uz^k}.$$
It follows that the generating function of the set of partitions with an even number of parts is given by
$$ G_1(z) = \frac{1}{2} G(z, 1) + \frac{1}{2} G(z, -1)
= \frac{1}{2} \prod_{k\ge 1} \frac{1}{1-z^k}
+ \frac{1}{2} \prod_{k\ge 1} \frac{1}{1+z^k}.$$
Similarly for an odd number of parts,
$$ G_2(z) = \frac{1}{2} G(z, 1) - \frac{1}{2} G(z, -1)
= \frac{1}{2} \prod_{k\ge 1} \frac{1}{1-z^k}
- \frac{1}{2} \prod_{k\ge 1} \frac{1}{1+z^k}.$$
Therefore
$$ G_1(z) - G_2(z) = Q(z) = \prod_{k\ge 1} \frac{1}{1+z^k}$$
and this is the generating function of the difference between the number of partitions into an even and odd number of parts.
Now observe that this is
$$\prod_{k\ge 1} \frac{1-z^k}{1-z^{2k}}
= \prod_{k\ge 0} (1-z^{2k+1})$$
because the denominator cancels all the factors with even powers in the numerator.
Here is an important observation: the above expression of $Q(z)$ enumerates partitions into unique odd parts in a generating function of signed coefficients where the sign indicates the parity of the number of parts. There is no cancellation between partitions that add up to the same value because the counts of constituent parts have the same parity. Moreover as all parts are odd, partitions of odd numbers must have an odd number of parts and of even numbers, an even number. Therefore the coefficients of $Q(z)$ alternate in sign.
To get the series that generates the absolute values of these coefficients, we create generating functions for the even powers and the odd ones, inverting the sign of the coefficients of the odd ones. The even ones are generated by
$$\frac{1}{2} Q(z) + \frac{1}{2} Q(-z)$$
and the odd ones by
$$-\left(\frac{1}{2} Q(z) - \frac{1}{2} Q(-z)\right)$$
Adding these gives $$ Q(-z).$$
But this is
$$\prod_{k\ge 0} (1-(-z)^{2k+1})
= \prod_{k\ge 0} (1-(-1)^{2k+1} z^{2k+1})
= \prod_{k\ge 0} (1+ z^{2k+1}),$$
precisely the generating function of partitions into distinct odd parts.
This is sequence A000700 from the OEIS.
Best Answer
The generating function for paritions into distinct parts is $$F(q)=\sum_{n=0}^\infty f(n)q^n=(1+q)(1+q^2)(1+q^3)\cdots=\prod_{m=1}^\infty(1+q^m).$$ Compare $$G(q)=\sum_{n=0}^\infty g(n)q^n=(1-q)(1-q^2)(1-q^3)\cdots=\prod_{m=1}^\infty(1-q^m).$$ Then $f(n)$ and $g(n)$ have the same parity: $f(n)\equiv g(n)\pmod2$. But $$G(q)=1+\sum_{k=1}^\infty(-1)^k(q^{k(3k-1)/2}+q^{k(3k+1)/2})=\sum_{k=-\infty}^ \infty(-1)^k q^{k(3k-1)/2}$$ (Euler's pentagonal number formula). So $f(n)$ is odd iff $n$ has the form $\frac12 k(3k-1)$ for some $k\in\Bbb Z$.