Apple has announced it will invest more than 500 billion dollars (£395 billion) in the United States over the next four years, including plans to hire 20,000 people and build a new server factory in Texas.