I can't. My mind is always wandering, regardless of what I'm doing. The more I try to concentrate on something, the more I think of something else.
The only time I can stay focused is when I'm writing and I'm sure that's because I'm constantly running scenerios through my head.
Sometimes the best way is to let your mind wander and not fight. When I allow it the freedom for a few minutes, then I regain my concentration easily after.
When I cannot afford to let it wander - for example, I have a thing to finish urgently - then I write down key points on a paper of things I'll allow myself to think of after. Once I do that, my mind is more relaxed because it knows that it can continue its journey later instead of trying to hold some image on my head for fear that I may forget about thinking it (especially when it's something I'd like to spend time to think about). Then I go back to work.