Edit: note that you can just go and read the accounts for Facebook UK here: https://beta.companieshouse.gov.uk/company/06331310/filing-h...
A very important piece of information is left out of the article: what Facebook UK is paying in "license fees" to other parts of Facebook.
The accounts show £131m in "administrative expenses", of which I can account for £86m in staff costs from the same document. £35m of that is a "share based payments charge", which represents the accounting treatment of share options. Of course, the shares handed out are shares of the US parent and not the UK subsidiary.
131-86=£46m which isn't broken down further.
So I don't think Toyota was running the same schemes we see in tax havens.
You then go and hire a good tax accountant who has experience with the Double Irish tax dodge (look it up on Wikipedia), and Bob's your uncle. (Though a double irish is harder to create for new firms since 2015 - you might have to acquire a ready-made shell corporation.)
Of course all this only makes sense if you have profits in the tens or hundreds of millions, so that paying for the shell companies, your Irish headquarters, your tax accountants and your lawyers is cheaper than actually paying tax.
So here's the deal. "Transfer pricing" is a thing, and it's what you're supposedly allowed to sell stuff at. https://en.wikipedia.org/wiki/Transfer_pricing
So if you sell something on the open market anywhere, you can't sell it to your foreign subsidiary or owner for too much more or less than the open market price. But things get dicey when you're talking IP: patents and trademarks don't trade on the open market but are absolutely vital for a subsidiary to be alive, right? Amazon isn't Amazon if it can't call itself "Amazon".
The other trick is to offer some kind of service that's difficult to precisely quantify like having an accounting or service center in one country that every foreign subsidiary is required to pay for. It might not be a reasonable price but the cost of auditing all the call center records to find out it's costing $3/minute (on average) for a particular US based company to outsource its support calls to somewhere instead of $0.10/minute is going to be very steep. Do this across a few different lines of corporate support and your profit hiding is accomplished.