Where a company pays tax is not merely based on where it is incorporated. If it has a business base in another country (what is called a permanent establishment), it will generally be subject to tax there. So one reason Ireland's 12% rate is attract is that Ireland is often also a good place from which to do business.
In contrast, the cases where you can use a Seychelles or Belize company without having a significant business operation there are more limited, though such tax havens have been used for companies providing finance or holding intellectual property (patents, copyrights, etc.). New international tax rules are trying to limit such uses.
In the past (before 1996?), Ireland determined corporate residence solely on the basis of place of central management, whereas the US uses place of incorporation, so a company incorporated in Ireland but with no business there and not managed there would not be subject to Irish tax. That was changed to add incorporation in Ireland as an alternative test for residence, but with an exception that a number of US tech companies were able to take advantage of. Following the outcry over Apple's 'stateless' subsidiaries, this exception is being closed down.