Real Madrid have signed midfielder Asier Illarramendi from Real Sociedad after agreeing to pay the buy-out clause in his contract.