Biology: I felt the answers for medicine, microbiology, and epidemiology may not give the complete picture. Of course this is my own opinion, as there are no real formal rules.
The unofficial rules: In biology, the first author is the person whose contribution is larger than that of any other author. It is cannot be the author that contributed more than the combined contribution of all other authors - this definition doesn't even work mathematically (a 25%/35%/40% contribution paper would have no first author).
However, the situation is more complicated. Usually, the subsequent order of authors is according to decreasing contribution. Also, at the end of the authors list the scenario is mirrored: The last author is the senior author (i.e. the PI) that contributed the most, with the order of senior authors again reflecting their contribution (mirrored).
Then, it gets even more complicated. In some cases, you can have co-first authors. This is usually marked by the journal, indicating that these authors had equal contribution. Then, there is the "corresponding author" mark. Some (but this is less widely accepted) use this is to signify equal contribution of the senior authors, so for example you would mark both last 2 authors as "corresponding authors".
Practical issues: While it may seem to be silly to people not used to this method, the order of authors is actually quite important. For graduate students and postdocs, fellowships and prizes will often only consider your first-author papers as your "real" papers - this is usually written in the rules (you may asked to list only first-author papers). Furthermore, if you are co-first (equal contribution), you will often be required to detail your exact contribution (sometimes your supervisor needs to detail it as well in these cases). For PIs, the situation is similar - funding agencies will often only consider your last author papers.
Another less important issue is association with the paper. A paper will be generally referred to by the first author's name, e.g. "Smith et al.". If you are the first author you will be immediately associated with the paper. If your paper is high-impact, there can be benefits to this in terms of establishing your name in the field. This is one reason why even "equal contribution" may not be considered really equal by some.
Biology vs. other disciplines: Finally, I want to explain why this practice might be useful in biology and how it is different than math or CS, for example. First, any graduate student or postdoc is always under supervision. It is customary that regardless of the actual amount of involvement of the supervisor in a project, the supervisor is always listed as the senior author. You have to remember that it is quite rare for PIs in experimental labs to actually do any actual work themselves (this is different from theorists). This is not to say they cannot be highly involved. Then, many projects are collaborations between multiple research groups. It is very common to see 15-20 authors on a paper, and recently there have been many papers published by research consortiums, having hundreds of authors (although in that case the order of the author list is slightly different). One author could really be doing much more work that some other author, which is on the paper just because he/she contributed some biological sample or ran some program.
Is it good? I don't think this system is optimal. It can lead to personal conflicts and affect people's careers. Some journals try to bypass this system by adding a section detailing the individual contribution of each author, but this isn't widely recognized. Some funding agencies ask you to quantitatively mark the contribution in percentage of each author - but how do you do that? It is extremely difficult to quantify. One author spent a lot of time doing experiments, and another spent a lot of time analyzing the results - who should be first? It is very subjective and in the end is often settled by politics.