The construction with size $O(n \cdot 2^n)$ is probably based on conjunctive normal form: we compute all conjunctions $$K_a(x_1, \dots, x_n) = (x_1 \oplus a_1 \oplus 1)(x_2 \oplus a_2 \oplus 1)\dots(x_n\oplus a_n \oplus 1)$$
(note that $K_a(x) = 1$ if and only if $x = a$).
There are $2^n$ of them with complexity $O(n)$ each, and then compute $f = \bigvee\limits_{f(a) = 1} K_{a}$ using at most $2^n$ disjunctions.
A more compact construction with size $O(2^n)$ is based on the same idea, but we compute all the conjunctions $K_a$ together by a circuit of complexity $O(2^n)$.
The idea is to use recursion and divide $n$ in half.
For a tuple $x = (x_1, \dots, x_n)$ consider its left half $\check{x} = (x_1, \dots, x_{\lceil n/2 \rceil})$ and its right half $\hat{x} = (x_{\lceil n/2 \rceil + 1}, \dots, x_n)$. Note that $K_a(x) = K_{\check{a}}(\check{x}) \wedge K_{\hat{a}}(\hat{x})$. So we can compute all conjunctions of $n$ variables as follows:
- compute all $2^{\lceil n/2 \rceil}$ conjunctions $K_{\check{a}}(\check{x})$ of the $\lceil n/2 \rceil$ variables in the left half
- compute all $2^{\lfloor n/2 \rfloor}$ conjunctions $K_{\hat{a}}(\hat{x})$ of the $\lfloor n/2 \rfloor$ variables in the right half
- Compute all $2^n$ possible conjunctions of the form $K_{\check{a}}(\check{x}) \wedge K_{\hat{a}}(\hat{x})$
Usually that is straightforward, but you have a restriction that the fanout must be $2$, so we cannot do the last step as the fanout of the gate computing $K_{\check{a}}(\check{x})$ is $2^{\lfloor n/2 \rfloor}$, and the fanout of each gate computing $K_{\hat{a}}(\hat{x})$ is $2^{\lceil n/2 \rceil}$.
To deal with this, we use the fact that a gate with fanout $q$ can be replaced by $q-1$ gates with fanout $2$ as follows:
1 1 1 1
| | | | | |
+-O-+ | | | |
/| | | | |
| +-&-+ | | |
| /| | | |
| | +-&-+ | |
| | /| | |
| | | +-&-+ |
| | | /| |
| | | | +-&-+
| | | | /|
| | | | | |
I hope the picture is clear. O denotes the original gate, and & is a conjunction gate, which propagates the same value because the second argument is $1$.
Let $S_n$ be the size of the constructed circuit. We have a recursion $$S_n \leq S_{\lceil n/2 \rceil} + S_{\lfloor n/2 \rfloor} + 2^n + 2^{\lceil n/2 \rceil} \cdot (2^{\lfloor n/2 \rfloor}-1) + 2^{\lfloor n/2 \rfloor}\cdot (2^{\lceil n/2 \rceil}-1)$$
Here the first $2^n$ are conjunctions required to compute $K_a$, and $2^{\lceil n/2 \rceil} \cdot (2^{\lfloor n/2 \rfloor} -1)$ and $2^{\lfloor n/2 \rfloor}\cdot (2^{\lceil n/2 \rceil} -1)$ count the chains of gates needed to establish fanout $2$.
Simplifying, we get
$$S_n \leq S_{\lceil n/2 \rceil} + S_{\lfloor n/2 \rfloor} + 3 \cdot 2^n$$
Then you can prove by induction that $S_n \leq a \cdot 2^n + b$ for appropriate $a$. I didn't check if $8 \cdot 2^n - 4$ works or not.