Simply, you want you best on-base percentage guys in the top 2 spots, your best RBI guys in 3-5, and the rest of the order goes from best hitter down to worst. The guys at the top of your lineup will get more at-bats, and are more likely to be leading off innings (they obviously lead off in the first, and with your weakest bats hitting 8th and 9th, they are more likely to lead off a new inning after an out frmo the bottom of the lineup). You normally want fast guys in the top few spots too, as if they do get on to lead off an inning, they can steal a base and your "big bats" that hit 3-5 can drive them in.
I will put the faster guy in my first spot and the guy with better contact and eye hitting second, to help move him over. The best all around hitter will then bat third, followed by my biggest power bat, then my a guy with solid average and power hitting 5th.
I will then place my next best overall hitter 6th, I like sticking a guy with some power 7th, and I like speed out of my 8 hole hitter. If using a DH, I would move my powerguy down to 8th and speed 9th, sticking the remaining guy in at 7th.