Getting your dog to pay attention or focus on you is the foundation for successful training. If your dog isn't focused on you, he isn't likely to respond to what you are asking him to do.
One approach to get your dog to focus on you is to position him in front of you or at your side. Let your dog know that you have a treat and then hold it just below your eyes, close to your face and say your "attention" word. (I use my dog's name.)
Slowly lower the treat to your dog's mouth, keeping eye contact the whole time. Maintain eye contact throughout the exercise. Mark the behavior by repeating his name and your reward marker of "good" or "yes" as he gets the treat.
Another approach is to notice when your dog is looking at you and say your attention word and reward your dog for looking at you. Some trainers believe that this approach is superior as it rewards the dog for "offering" the behavior rather than asking for it.