I'm not sure how Apple Music does it on the backend, but if I had to guess it would be based off of genre and playlist/user activity (Some sort of statistical model which determines which artists are likely to be present in user playlists/listening activity together).