I was solving this problem:
Let $S(n)$ denote the number of squarefree divisors of $n$. Establish that $$ S(n) = \sum_{d \mid n} \lvert \mu(d) \rvert = 2^{\omega(n)},$$ where $\omega(n)$ is the number of distinct prime divisors of $n$.
But I do not understand why the first equality is correct (for the second equality I have no problem), could anyone explain it for me?
In short, the möbius function takes one of the values $-1, 0, 1$. We know that $\mu(n) = 0$ if $n$ is not squarefree, and $\mu(n) = \pm 1$ if $n$ is squarefree. Thus $\lvert \mu(n) \rvert$ is the squarefree indicator function --- it is $1$ if and only if its argument is squarefree.
$S(n)$ counts the number of squarefree divisors. One way to count this is to look at all the divisors and add $1$ for every squarefree divisor: and this is precisely what the sum does.