Blizzard can detect sharing, but it's not always easy to determine whether someone has shared their account or not. The best way to avoid detection is to make sure that you are only playing the game on one device at a time.