On the Origins of Linear Representations in Large Language Models