Islamic State claimed responsibility for a New Year's Day mass shooting in a packed Istanbul nightclub that killed 39 people.