Time outs are a way for mandating time away from positive reinforcement, and as such, are a form of negative reinforcement.
A time out is the separation of a child from the situation that is causing unwanted behavior. These days this usually means that the child is sent to an empty room, although traditionally the child is sent to sit in the corner, facing the wall. However, it can be as little as simply withdrawing attention from the kid, e.g., "I'm not playing with you if you're doing that".
The general rule for time outs is one minute for each year of the kids age, but with an upper limit of 5 minutes no matter how old they are. You should use a timer! This keeps the time objective (you aren't going to forget the kid, or let them out early because you're in a hurry), and it also helps cut down on whining; while kids like to think they can charm/annoy anyone into letting them up earlier, they aren't likely to try this with the timer.
It is usual for a time out to include a 'no moving' clause, or the even stricter 'don't do anything fun' clause. As long as the child isn't playing with, talking to, or otherwise interacting with other people (including you) the time out should be effective. I would suggest not allowing television or toys during time outs, tho. If the time out is because of a dispute over a toy, they toy absolutely should not be taken into time out -- that will only send the message that acting out will get you what you want.
Time outs are usually seen as a negative consequence* to undesired actions: "you did something wrong, so go sit over there!" But time outs can simply be a chance for a child who has become to excited and overwhelmed to rest, relax, and reset. Keep in mind what kind of time out your kid needs; a calming down time out can include toys, books, and even other kids.
You should always let the child know why e is being put into time out. It's often a good idea to restate the reason when letting them come out of time out, especially with younger children.
If the time out is a 'consequence', this is a good time to start/keep doing something that looks like fun -- not to be cruel, but to reinforce the idea that when you are in time out, you didn't win (by getting the teachers attention, disrupting the game, etc.), and you are missing out on the fun. It will make sure that the kid doesn't want to go into time out again, and therefore doesn't engage in those behaviors that earn time outs. The time out should end before the new fun game does, and the kid should be able to join in, have fun, and feel that e is part of the group again.
Once a time out is finished, it's finished. You might require that apologies be made, messes are cleaned up, etc. But don't hold a grudge. Be clear what is needed to pay dues, make sure it is something the child can do, and then once it is done, forget that anything ever happened. Don't hold it over the kid's head. The normal state of things should be friendly, and you need to let the kid get back to that normal state as soon as is possible.
* These days punishment is a bad word. We're not supposed to punish children. We can let them know that their actions have consequences, tho. Some of these consequences will be negative consequences. So be it.