<s>[INST] Why is $\int \sec x\,dx$ equal to $\ln | \sec x + \tan x |$? Everyone knows that $\int \sec x\,dx = \ln | \sec x + \tan x |$?
But how to reach it through a conscious deduction, through a clear and objective way?
 [/INST] It's almost always correct to revert any trig function in an integral to its definition in terms of $\sin x$ and $\cos x$. 
So write $$\sec x = \frac{1}{\cos x} = \frac{\cos x}{\cos^2 x} = \frac{\cos x}{1-\sin^2 x}$$ Then substitute $u=\sin x$ and $du=\cos x\,dx$. That leads to $$\int \frac{du}{1-u^2}$$ which you then apply partial fractions to get an expression in terms of $\ln$. $$\frac{1}{1-u^2}=\frac{1}{2}\left(\frac 1{1-u} + \frac{1}{1+u}\right)$$
So this gives you $$\frac{1}{2}\left(\ln\left|1+u\right|-\ln\left|1-u\right|\right)=\frac{1}{2}\ln\left|\frac{1+u}{1-u}\right|$$
Substituting $u=\sin x$ into $\frac{1+u}{1-u}$ and multiply numerator by denominator by $1+\sin x$ we get:
$$\frac{1+u}{1-u} = \frac{(1+\sin x)^2}{1-\sin^2 x} = \left(\frac{1+\sin x}{\cos x}\right)^2=\left(\sec x +\tan x\right)^2$$
</s>