I am going to take a very simple example to elaborate my question.
When we integrate $\sec (x)\,dx$ we divide and multiply by $\sec (x) + \tan (x)$.
$$\int \sec(x)\,dx = \int \sec (x) \left[{\sec (x) + \tan (x) \over \sec (x) + \tan (x)}\right]\, dx$$
I am just solving from here.
$$\int {\sec^2(x) + \sec(x)\tan(x) \over \sec(x) + \tan(x)} \, dx $$
Then we let $\sec(x) + \tan(x) = u$
$$\implies du = (\sec^2(x) + \sec(x)\tan(x))\,dx$$
$$\implies \int {du \over u}$$
$$= \ln{\left|\sec(x) + \tan(x)\right|} + c$$
Now coming to my questions.
Why do we HAVE to make that manipulation of multiplying $\sec(x) + \tan(x)$. Like I know its to get the answer...but why does it work so well?
How to even think like that? Like "if I multiply $\sec(x) + \tan(x)$ in the numerator and denominator then I'll be able to solve this very easily." What in that integral gives one direction to think of such a manipulation ?
I'll answer your second question. It's a great question, and asking it is really important for getting better at solving math problems. In general, with integral questions, I would say that thinking about these kinds of things just comes with experience and seeing a lot of similar problems.
However, in this case, such intuition isn't enough (in my opinion). I think rather that this is one of those things where people tried for a while to find an antiderivative for $\operatorname{sec}(x)$, and someone happened to come up with this after messing around for a while.
(Also, practically speaking, I think that such a question would be too difficult for an exam, if students hadn't already seen the trick.)