With any investment, there are two forms of tax.
While you are earning income from the investment, you pay tax on the income, and any reasonable money spent earning that income is a tax deduction (even if it is more than you earn). This includes the interest (not principle) on the mortgage and any maintenance costs.
When you sell an investment you pay tax on the appreciation of that investment. If you increase the value of the investment, by renovating it... the increase in value of the investment is not taxed. So if you bought a property for $500k, and sold it for $600k after you'd owned it for a while, you'd pay tax on the capital gain of $100k.
If you didn't sell it, but at that point got it valued at $600k, then demolished the house and built a new one for $200k, and the new valuation came in at $700k, then you sold it a few years later for $800k, you'd pay tax on the capital gain of $100k + $100k = $200k because you could show that you'd added $100k of value to the investment.
A lot of people find the difference between these very confusing. If the hot water service blows, the replacement of the hot water service is clearly maintenance except if you decide to replace the old small hot water service with a new much bigger hot water service - which is actually an increase in value of the property.