Over at Uncertain Principles, Chad Orzel's commentators got into a discussion of how you list people in a large multi-author publication. My system is that the first author and the last author are the people who did most of the work and/or were in charge. It's worth amoment to think about the gap that can open up between those two descriptions. Between those bookend names, I've opted for alphabetical order when I've written or helped write papers, because the alternative is an institutional-sized easy-open pressurized Can O' Worms.
Assigning credit in a scientific project is an awful job. Multiple people will be sure that they thought of an idea first and that everyone else just borrowed it from them. Some people will be livid at how others on the team got by without seeming to ever contribute anything, while they carried the whole project on their backs. Meanwhile, some of that latter group will be furious at the first ones, who from their perspective got to do the easy stuff that generated all the cheap and flashy results while they labored in the salt mine.
Sometimes these things can be resolved by enough tedious effort, but most of the time they can't. And it's almost always not worth the effort - at least for a journal article. Now, for a patent, things are very different, as one of Chad's commentators rightly points out. Everyone listed on a patent has to be able to state clearly what their contribution to the invention was. If you can prove that a patent has people on it that did not contribute (or left out people who did), you can get the thing invalidated. That's not easy, but it has happened, and the mere threat is enough to make everyone take inventorship pretty seriously.
My quick-and-dirty test for inventorship has been to tell people to ignore the whole draft of the patent application except the claims. Go straight to those, and find something there that you thought of, and be ready to point to it. Ideally, you should check to make sure no one else is going to point to the same thing. Best are the things that you thought of first and were also the first to do. No one can take that away from you.
Next best are the things that you thought of first and handed off to someone else to accomplish - if they didn't add anything to your idea, you're probably an inventor and they certainly aren't. Being the first one to try someone else's idea in the lab doesn't mean much in inventorship terms, and quite rightly. Now, if the person you handed things off to added something meaningful, you may both be inventors, which is were things can become interesting. Sometimes the original idea has been mutated so thoroughly that the final claim is really the work of the second person, with nothing recognizable from the first one.
I tell people who work for me that if they want to be on the patents coming from our lab, they'd better have some ideas of their own to show when patent-writing time comes. Naturally, I try to fulfill my end of that deal by letting people work on their own stuff as much as possible. The only way we can end up in trouble is if we pick a total-loss part of the molecule to work on and end up with nothing worth including in the patents. You want to keep a sharp eye out for that situation, and be ready to steer yourself (and your lab) out of it.