The step you're wondering about is the heart of the integrating factor procedure. Suppose you had the DE

and you multiply through by the integrating factor Then you get

The whole point of the procedure is that the LHS is now a total derivative. Indeed, if we examine

which is just our new LHS after we multiplied through by the integrating factor.

Someone was clever enough to discover that the integrating factor was indeed and after that, it became a procedure.

Does that clear things up a bit for you, perhaps?