DD started doing this at a similar age.
We started doing a very orchestrated countdown to bed time.
ie "at the end of x programme we'll go upstairs to get your pyjamas on, then read you a story, then we'll do 10 elephants (i'll explain in a mo) and then it's time to sleep."
Then "x programme is nearly finished, when it's finished, we'll go upstairs to get your pyjamas on, then read you a story, then we'll do 10 elephants and then it's time to sleep."
etc etc.
So she knew and was prepared. 10 elephants was the final leaving the room countdown. We'd count up to ten, and that would be the cue to leave the room. But, it turned into 10 kisses, or, thinking of 10 different animals up to ten ie 1 elephant, 2 monkeys, 3 giraffes etc and DD would pick the animal or we'd take it in turns.
Sounds very convoluted, and it is I suppose, but it worked.