It is hard to explian to kids why they're in time out or being punished or whatever.
The "supernanny" way seems to be pretty effective. You have a designated "naughty spot" or "time out spot". When the child does something he/she isn't supposed to, you place them in the time out spot, and tell them, "I'm putting you in time out because...(fill in the blank)..and you're in time out for ___ minutes." and it's 1 minute per year of age. When the time out is over, you go talk to them and say, "Do you know why you were in time out?" and try to briefly explain that it isn't nice to hit (or whatever the infraction was - that we have to play nice, or whatever), then hugs/kisses.
Now that being said, I have a 2.5 year old, and I know she's too young to understand what's going on with time outs. We typically do what others have suggested...tell her "no hitting' (or whatever the infraction was) and remove her from the situation - take her somewhere else in the house to play or another corner of the playroom. Sometimes, if you're keyed in to what's going on, there are times you can prevent the infraction from happening, but many times the sequence of events happens in such a way to prevent that.
For what it's worth, and good luck!