The most serving way to enter in to any meditation is without expectation. Simply place the intention in your mind and in your surroundings, that you are going to spend time quietly, slowing yourself down. I say this because the greatest deterrent for people starting meditation is the expectation that they will meditate “perfectly"; that they will not have rampant thoughts running through their minds. It's all or nothing. They will either have a successful session that leaves them calm and relaxed, or the session will be a waste of time because they can't corral their thoughts.
What's the difference between intention and expectation?
Intention is the thought and emotion you project that leads you to undertake whatever you wish to accomplish. The belief is that once you set your intention, your mind, body and soul, will look to accomplish it above all. The most important thing to remember about intention is that it is not dependent on outcome. It simply sets the stage for what you want to accomplish. It may transpire, and it may not. However, chances are better it will happen with the focus placed on it. But again, the result is not important. It's not the goal.
Expectation, as you may expect (no pun intended), is the exact opposite. You not only wish to accomplish something, but your mind is set on it happening, in that way. At first thought, this may seem more beneficial than intention. You want something to happen and you make it happen. That mindset is one that is very deeply ingrained in western culture. However, it is not beneficial in meditation, and in most cases, not that optimal for life either.
In meditation, the goal is not perfection, it's experience. Whatever happens, happens. Your success is not tied to an outcome. Your "success" is linked to the practice.
What does all this have to do with the question? It's a preparation for letting you know that your focus will rise and fall throughout your meditation. Depending on the day, your mind may wander repeatedly throughout your session, and at other times it will be more still. With that understanding in mind, you will experience less frustration when meditating. You will accept either outcome equally; which is definitely a premise of a meditation practice. You don't place value on either outcome, you just observe them objectively, just like you do with your thoughts during a session.
Now let me answer the question very practically. How do you stay focused? The answer is simple. Your mind can have only one thought at time. Therefore, whenever you notice a stray thought entering your mind, you gently move your attention/focus on to something else; with most meditations, it is the breath. You stop putting attention and/or emotion on the stray thought and instead focus on your breath entering and leaving the body. You not only think that thought, but you experience it with all your senses. You feel the cool air entering your nose or mouth. You feel your chest and abdomen rising and falling. You hear the air being inhaled and exhaled. The more senses you incorporate into the focus of your breath, the weaker the initial intrusive thought becomes, until it is forgotten.
Even though the breath is one thing you can focus on, there are others as well. Some practices have you reciting a word, phrase, sound or mantra to act as the focus.
When you are starting out meditating, chances are good that you will need to redirect your mind to your breath (word, sound or mantra) repeatedly. Many newer students get frustrated, thinking that if they need to redirect their focus to their breath multiple times, that they are either meditating wrong or failing.
Nothing is further from the truth. As you practice more, generally your focus will improve. Yet in the beginning it is totally natural for your mind to wander. Don't become discouraged by how many times you need to refocus.
Truth be told, even if you have been meditating for years, you may still have a session where your thoughts are all over the place. Again, simply allow whatever happens, to happen. You took the time to still your mind, and that is what will not only benefit you, but the world as well.