I get something different from calling expand. I think what you are
generally looking for here is collect:
In [66]: print(e)
(A*cos(th) + B*cos(th) + C)/D
In [67]: print(expand(e))
A*cos(th)/D + B*cos(th)/D + C/D
In [68]: print(expand(e).collect(cos(th)))
C/D + (A/D + B/D)*cos(th)
In [69]: print(expand(e).collect(cos(th), factor))
C/D + (A + B)*cos(th)/D
In [70]: print(e.collect(cos(th)))
(C + (A + B)*cos(th))/D
--
Oscar