Problem understanding integral evaluation

I am having trouble understanding the evaluation of an integral. Do we just separate the integrals and evaluate them? Is it like normal integration?

I have provided an example below taken from one of my tutorial questions, it would be great if someone explains to me on how the evaluation of an integral takes place. I can try solving my other tutorial questions if i am able to understand the manner in which integrals are evaluated.

Evaluate the following Integral:

$$\int \cos x( \tan x +\sec x)\mathrm{d}x$$

Ans: $- \cos x + x + C$

-
Simplify $\cos(\tan(x)+\sec(x))$ first. Can you handle the integral after simplifying? – Git Gud Mar 24 '14 at 10:26
@GitGud Thank you, will try with the other problems :) – Phantom Mar 24 '14 at 10:38

We can simplify the expression a good deal since $\tan x = \frac{\sin x}{\cos x}$ and $\sec x = \frac{1}{\cos x}$:
$$\int \cos x (\tan x + \sec x) dx = \int \cos x (\frac{\sin x}{\cos x} + \frac{1}{\cos x}) = \int (\sin x + 1) dx = -\cos x + x + C$$