Simplifying complex expression of Exp or trig functions

I want do get the imaginary part of

Exp[I*t]/(1-Exp[I*t])

I’ve tried to do this

Im[ComplexExpand[Exp[I*t]/(1-Exp[I*t])]] 

but the result still contains

Im[Cos[t]/((1 - Cos[t])^2 + Sin[t]^2) - 
   Cos[t]^2/((1 - Cos[t])^2 + Sin[t]^2) - 
   Sin[t]^2/((1 - Cos[t])^2 + Sin[t]^2)] 

which in fact is 0 (t is a real variable). How can I convince Mathematica to get rid of this part of the expression?

Hi, I am not sure whether I fully understand the question, but does Simplify do the trick?

  In[56]=   Im[ComplexExpand[Exp[I*t]/(1 - Exp[I*t])]] // Simplify
    
  Out[56]=  1/2 Re[Cot[t/2]]

Cheers,
Marco

Re[…] should not be necessary here!
When t is real, Cot[t/2] also is Real
But

Simplify[Im[ComplexExpand[Exp[I*t]/(1 - Exp[I*t])]], Element[t, Reals]]

does the trick!

What I reallyn wnatm though, is

Simplify[Im[ComplexExpand[Exp[I*t]/(q - Exp[I*t])]], Element[{q, t}, Reals]]

which produces

(-1 + q Cos[t]) Im[1/(1 + q^2 - 2 q Cos[t])] + q Re[1/(1 + q^2 - 2 q Cos[t])] Sin[t]

but with real t and q

Im[1/(1 + q^2 - 2 q Cos[t])]

is 0 and

 1/(1 + q^2 - 2 q Cos[t])] 

is real, therefore Re in the second part of the expression is unneccessary

But what I really need id the following:

Simplify[Im[ComplexExpand[Exp[I*t]/(q - Exp[I*t])]], {Element[{q, t}, Reals], Abs[q] < 1}]

It gives the answer I expect:

(q Sin[t])/(1 + q^2 - 2 q Cos[t])

Put the Im inside the ComplexExpand.

In[2]:= ComplexExpand[Im[Exp[I*t]/(1-Exp[I*t])]]
Out[2]= Sin[t]/((1-Cos[t])^2+Sin[t]^2)

In[3]:= Simplify[ComplexExpand[Im[Exp[I*t]/(q-Exp[I*t])]],Element[{q,t},Reals]]
Out[3]= (q Sin[t])/(1+q^2-2 q Cos[t])

Better?

The last simplification even works without the assumptions:

Simplify[ComplexExpand[Im[Exp[I*t]/(q - Exp[I*t])]]]

gives

(q Sin[t])/(1 + q^2 - 2 q Cos[t])