The stay command is a little bit trickier than down or sit. It involves multiple steps that must be done properly or they can be counter-productive. Get your dog in whatever position you want them to stay in. You can teach stay in a standing, sitting, or down position. Stand in front of your dog, so that you are facing them. Once you have your dog in the position you desire keep repeating the word stay. Get your dog to stay still for just a second at first, with you directly in front of them. If your dog stays reward them with a treat and love and affection; happily saying stay, and telling them they did a good job. After this step is repeated and your dog stays on command there are a couple variables you want to add to make sure they got it.
First off, try to add some time to how long you make them stay. Simply repeat the previous steps, making your dog stay in whatever position you choose for longer and longer of a duration of time. Start out with a second, then a couple seconds, then 10-15 seconds, and so on. Keep repeating "stay" while they are still. If they move out of position sternly tell them "no," simply reset them back into the stay position, and start over. Once they have stayed for the duration of time reward them with a treat and love and affection.
The second variable is to put some distance between you and your dog. Stand in front of your dog; just as you had before. Begin backing away from your dog repeating the "stay" command. If they move tell them "no," reset them, and start over. If they stay still as you are slowly backing up then they learned stay, and should be rewarded with a treat and love and affection. However, and this is very important, they are being rewarded to stay so they should not move to be rewarded. Come back to your dog and make sure you reward them in the stay position that you had them set in. Continue repeating this step adding more and more distance between you and your dog.
The third step is to add distractions to the situation. Being around other people or animals is a distraction. Taking your dog into a public setting is one way to add distractions (just make sure you keep them on an extendable leash so they don't run off). You can also simulate distractions in your own home. Get your dog to stay. Back away from him as you did before in the distance step. Drop a treat on the floor and back away from it. Make sure you do not back up too far (you don't want your dog to be able to get up and get the treat). Keep repeating stay. If your dog gets up to go get the treat simply pick up the treat before the dog gets to it, reset the stay position, and start over. If your dog stays with the treat on the floor, pick the treat up, bring it to your dog, and reward them with the treat and love and affection.