Here is a slightly more structured approach to arriving at an answer which is not simply based, as you say, on a "pure guess."
Let
$$J = \int \frac{1 - a \cosh x}{(\cosh x - a)^2} \, dx.$$
To find the integral $J$, the appearance of the all squared term in the denominator of the integrand suggests it may be possible to make use of the so-called reverse quotient rule (For another example using this method see here).
Recall that if $u$ and $v$ are differentiable functions, from the quotient rule
$$\left (\frac{u}{v} \right )' = \frac{u' v - v' u}{v^2},$$
and it is immediate that
$$\int \frac{u' v - v' u}{v^2} \, dx = \int \left (\frac{u}{v} \right )' \, dx = \frac{u}{v} + C. \tag1$$
For the integral $J$ we see that $v = \cosh x - a$. So $v' = \sinh x$. Now for the (generally) harder bit but in this particular case it is quite easy. We need to find a function $u(x)$ such that
$$u' v - v' u = u'(\cosh x - a) - u \sinh x = 1 - a \cosh x.$$
After a little trial and error it is quite easy to see that if
$$u = \sinh x,$$
as
$$u' = \cosh x,$$
this gives
$$u' v - v' u = \cosh^2 x - a \cosh x - \sinh^2 x = 1 - a \cosh x,$$
where we have used $\cosh^2 x - \sinh^2 x = 1$, as required.
Our integral can now be readily found. The result is:
\begin{align}
J &= \int \left (\frac{\sinh x}{\cosh x - a} \right )' \, dx = \frac{\sinh x}{\cosh x - a} + C.
\end{align}
as expected.