I worked in the bizz a few years.
Biggest advice I can give, is first off NEVER EVER EVER tell them up-front whether you're buying or leasing, ESPECIALLY if leasing.
ALWAYS choose a SPECIFIC vehicle, and negotiate a price FIRST.
As mentioned, research. go to edmunds.com and research the vehicle, including MSRP and invoice prices, then check the incentives and rebates also on Edmunds.com. Never overlook ANYTHING: manufacture to dealer incentives (also referred to as dealer cash), manufacturer-to-buyer (the hawked rebates) and always remember dealers also get more: qty returns on volume, holdback, ad pools, etc...
and NEVER pay more than a couple hundred as a dealer fee.
I myself don't mind paying $100-200 as a dealer fee if I've totally nailed them on the car price, but never more than that.
There's a ton of information on the InterWebz - use it to your advantage.
You can usually scan through a dealer's inventory online, choose 1,2, maybe 3 cars, and research the invoice and MSRP on it.
This way, if 1 is sold, you have 2 backup plans.
You can go in with those 2-3 cars, know what the invoice is, and make an offer.
This way they KNOW you're not wasting time.
Don't buy into theur good guy-bad guy crap, like the salesman saying he's on your side, and he's going to try to get you a number... gimme a check so he sees your serious...
Just flat-out say here's the number I want, can you do it yes or no. If I wasn't serious, I wouldn't BE here.
If you're going to have the dealer finance, that's another bargaining chip you can use, as they make $ of a point or two added to what the bank actually gave.
Any question, feel free to ask. I'm sure there's even more folks that were in the biz.
and yeah, end of month/quarter/year is the BEST time to buy, as they have goals to reach.