I am attempting to follow this line in a proof:
$\frac{n}{\phi(n)}=\prod_{p|n}(1-\frac{1}{p})^{-1}=\prod_{p|n}(1+\frac{1}{p-1})=\sum_{d\delta=n}\frac{\mu^{2}(d)}{\phi(d)}.$
I follow the logic up to the third equals sign, (i.e. $\phi(n)=n\prod_{p|n}(1-\frac{1}{p})$) but why does
$\prod_{p|n}(1+\frac{1}{p-1})=\sum_{d\delta=n}\frac{\mu^{2}(d)}{\phi(d)}$?
Let $S$ be the set of all primes dividing $n$. Then we can expand
$$\prod_{p \mid n} \biggl( 1 + \frac{1}{p-1}\biggr) = \prod_{p \in S}\biggl(1 + \frac{1}{p-1}\biggr) = \sum_{A \subset S}\Biggl( \prod_{p \in A} \frac{1}{p-1}\Biggr).\tag{1}$$
For $A \subset S$, we have $\prod_{p \in A} (p-1) = \phi\bigl(\prod_{p \in A} p\bigr)$ and thus
$$\sum_{A \subset S} \Biggl(\prod_{p\in A} \frac{1}{p-1}\Biggr) = \sum_{A \subset S} \frac{1}{\varphi\bigl(\prod_{p \in A} p\bigr)}.\tag{2}$$
The products of distinct prime divisors of $n$ are just the squarefree divisors of $n$, and the squarefree divisors of $n$ are in a natural bijection to the subsets of $S$ (namely, $A$ corresponds to $\prod_{p \in A} p$), thus we can write the right hand side of $(2)$ as
$$\sum_{\substack{d \mid n \\ d \text{ squarefree}}} \frac{1}{\phi(d)}.\tag{3}$$
Furthermore, $\mu^2(d)$ is $1$ for squarefree $d$ and $0$ for $d$ divisible by the square of a prime, so we can use $\mu^2(d)$ to sieve out the non-squarefree divisors and write $(3)$ as
$$\sum_{d \mid n} \frac{\mu^2(d)}{\phi(d)}.$$