Prove $\sum_{k\mid n}{\mu(k)d(k)}=(-1)^{\omega{(n)}}$

Look at the sum for a prime power $p^k$. The divisors of $p^k$ are $1,p,p^2,...,p^{k-1}$. All of them contain a square except $1$ and $p$. That means $\mu(p^a)=0$. So the sum is $$\mu(1)d(1)+\mu(p)d(p)\\=1\times 1+(-1)\times 2=1-2=-1$$ So each different prime, or its power, contributes a factor (-1).


Another, Combinatorial, way would be like $$\sum _{d|n} \mu (d) d(d)=\sum _{i=0}^{w(n)}\sum _{p_1<p_2 \ldots < p_i}\mu (p_1 \dots p_i)d (p_1 \dots p_i)=\sum _{i=0}^{w(n)}\binom{w(n)}{i}(-1)^i2^i=(1-2)^{w(n)}$$ where the $p_j$ are primes in the descomposition of $n$.