Since 1 - tan2 x is the difference of two squares, it factors into (1 - tan x)(1 + tan x).
Since the denominator is tan x + 1 and that is the same as (1 + tan x), those two factors will be "canceled."
The remaining term in the numerator, 1 - tan x, is the simplified form of this fraction.