Apple CEO Tim Cook will step down after leading the company for 15 years, with hardware chief John Ternus set to succeed him.