My DD just turned 2 and has been pulling the same trick. :/
When she gets up and plays with a toy, I go in the room, DON'T TALK TO HER at all, and put her back in bed. When I leave I take the toy with me.
When she gets up and just 'hangs out' without playing with her toys, I put her back in bed (again without talking to her.)
When she is being seriously obnoxious about it, I will sit near the door where I can see her, but she can't see me. When I see/hear her start to get up I immediately put her back. If she tries to make THAT into a game then I firmly (but quietly) tell her 'NO' and leave the room.
I have found that in addition to our regular bedtime routine, giving her 10 minutes of 'quiet time' where she can look at her books, color, or any other calming activities really helps put her in the mood for bedtime. I know I like to unwind on the computer (like I'm doing now) or read a book right before bed.
Sometimes, my DD actually does need something though. There have been times I spent a lot of time trying to get her to fall asleep, only to end up letting her have a sip of water and she passes right out.
I DO believe in spanking when the situation calls for it... but I try to avoid it at bedtime. All it accomplishes is making her mad and uncomfortable... Not the best recipe for sleep. Same with threats.... I try to handle all nighttime discipline in as much of a calm, quiet manner as possible. Once she realizes that she won't get away with being out of bed, and that she won't get any extra attention, she gives up and goes to bed.