Historical development of Möbius function

Recently I have been familiarized with the concept of 'Möbius function'. As far I
know the Möbius function is defined by

$$\mu(n) = \begin{cases} 1 & \small \text{if n is a square-free positive integer with an even number of prime factors.} \\ -1 & \small \text{if n is a square-free positive integer with an odd number of prime factors.}\\ 0 & \small \text{if n has a squared prime factor.} \end{cases}$$

But I'm very interested to know how the concept of Möbius function developed historically. What situations or problems led the mathematicians to initiate the concept of Möbius function? Can anyone explain?