Assuming you're talking about income tax and not sales tax etc it works like this.
1. All companies apply the tax rules of whatever country they are resident in, which usually means their worldwide income is taxable in that country this is true for SaaS and non-SaaS.
A company could be tax resident in multiple countries or none depending on local corporate residency rules and tax treaties.
2. Aside from this companies are a also taxable in local source income wherever they operate. This gets tricky especially for SaaS companies because "where is the income sourced?" this will usually be where the work is taking place if there's a fixed place of business or management level work taking place there but might also be taxed where the customers are located if the income is considered royalties income.
You've got to dive into the details of your individual case to see how these apply to you and of course it's in your best interest to structure yourself to minimize these.
There's also many cases where maybe technically you should be taxable but realistically you've got no exposure so in practice you won't be.
Finally, you could also be taxable based on the ownership of the company but this gets a little more technical.
Contrary to what was listed above Bermuda is rarely a good place to set up a SaaS company.
Hope that helps.