Under CEO Tim Cook, the company has found some answers and flourished financially, but it hasn’t been without a few wrong turns and big changes to the very nature of its business.