Teaching your dog the "stay command" will help your dog stay where they are until you tell them that it is OK to move. This trick can be helpful in many circumstances and can also help keep your dog safe. It can keep him/her from running into potentially dangerous situations (such as running into the street where there are moving cars). I can't stress the importance of teaching your dog to stay.
Your dog will need to know the sit command in order to properly teach them the stay command. For this trick, you will need to put a leash and collar on them. Tell your dog to sit and reward them for sitting. Hold the leash in your hand and walk back one step and say "your dog's name" than say "stay". Remember, firm tone of voice. Tone is important. If your dog doesn't move, reward them with praise or a treat. If they do move (which they probably will) Repeat the above until they stay. Slowly move back a little further each time that you tell them to stay. If he stays, always remember to praise him. Dogs are like humans- they love to know that they did good. Repeat the above often and eventually your dog will catch on and stay. Don't reward them if they don't stay.
When your dog reaches this point, you need to remove the leash from them and repeat the trick. If they don't move, increase the time you tell them to stay to a minute than two minutes etc. Also try walking around your dog when you say "stay". Before long your dog will become a pro at this. After your dog masters this trick indoors, you will need to teach them the same trick outside. You should teach your dog this trick until they become a pro at it both indoors and outdoors.
Remember that dogs have short attention spans so keep the training sessions in 15 minute intervals. If you haven't taught your dog to sit yet, refer back to the post that discusses that. Here is the link to that post if you are interested
Happy dog training to you :-)