The Irish company licenses intellectual property from an Apple registered company in the Cayman Islands, and of course the Royalties are so high that the Irish company makes no profit.
So all this money accumulates offshore and can't come back to the US unless some taxes are paid, which is why Tim Cook meets with Congress to try and lobby for a tax repatriation holiday.
Which is also why Tim Cook is raising money in the debt markets to pay shareholders dividends - it's cheaper to pay a tiny bit of interest than pay tax. Absurd that such a rich company is doing this.
Ironically, the money is already back in US - the Caymans entity invests the money in the US stock market via Braeburn Capital, a hedge fund based in Nevada and owned by Apple Inc!