[ Physics ] Open Question : How do magnetic fields attract or repel each other?

I'm mostly wondering because of motors, like the ones WITH Brushes. I can't find anything on the internet, and I really need to know how motors work. But to know that I need to know if magnetic fields going in opposite directions will repel or attract or if magnetic fields going in the same directions repel or attract. While you answer could you please explain a motor that does not have a wire in the middle and that DOES have brushes at the ends?

Source: http://answers.yahoo.com/question/index?qid=20110303035905AARGuRS

Charlie Sheen Lindsay Lohan Natalie Portman