This is no simple question and the answer involves many different sorts of people. To get the facts straight, I turned to an ex-staffer, Marci Harris, who just recently worked on the health care legislation in Rep. Pete Stark’s office and had the following to say. (If you want the short answer, there’s a summary at the end.)
Ideas for Bills


There are lots of little bills pending at any time before both the House and Senate, and the ideas behind these small bills come from many sources.  Lots of bills start as news clippings: a Member may read a newspaper article and come in the next morning and tell his staffer to draft a bill to address the issue. And it’s not hard to imagine the origins of bills that would require or .  Others originate from a constituent letter about a particularly compelling issue, or a request from a professional advocate representing a trade association, union, nonprofit, or corporation.
Turning to Staff Lawyers
When a staffer is drafting the bill (either at the Member’s direction, or to pull something together to propose to the Member), they will send a request to the House or Senate’s Office of Legislative Counsel (OLC or “Leg Counsel”) and be assigned a lawyer to work with on turning the idea into legislative language. One of the best analogies I have heard for the who and how of writing laws is a comparison to computer programming.  Lots of people may have an idea of what would be a good software application, but only someone who knows the language of the code can actually write the app in a way that works and can be executed.  So, going with the analogy, the “programmers” in Congress are the lawyers in the OLC, who are completely professional, absolutely unpartian, are around longer than most Members of Congress, and could be making bazillions in the private sector.
OLC’s lawyers turn plain language such as “insurers should not be able to drop you when you are sick” into an amendment to Section X, subsection Y, subpart Z to the Social Security Act, with conforming amendments in the Public Health Services Act, etc. and on and on.  OLC works with all members, regardless of party.   The assignment of a lawyer to a particular issue is based on their specialty – i.e. there are specialists in the IRS Code, specialists in the Social Security Act, etc.  (and “specialist” means they have probably actually drafted significant parts of those laws).
Here’s a , who heads up the health care team for the House’s OLC. He was writing the health care bill then, and he wrote the one that was just signed into law today (with help from other lawyers in House and Senate OLCs).

Reviewing the Draft

Once the staffer has a draft, he or she will probably vet it with trusted experts and organizations that have an interest in the issue.  It is always true that those actually affected by the legislation will troubleshoot its potential positive and adverse effects better than one staffer.  Sometimes those suggestions, especially by professional advocates (i.e. lobbyists), are offered in the form of legislative language or line edits to proposed language.
After the bill has been vetted and the Member agrees to introduce it, a printed copy is signed by the Member and delivered down to the “Hopper” on the House Floor (or similarly for the Senate).  Usually that just means an intern hands it to the clerk minding the door to the Floor, and they get it to the Hopper — in a much less dramatic fashion Legally Blonde II would have you believe.  It is then processed and given a number.
Big Bills and the Christmas Tree

These little bills frequently never come to a vote on their own, but they are important.  Through the co-sponsorship process, and by building support for these small bills through constituent input and endorsements by organizations or businesses, supporters of these bills demonstrate to Leadership that the idea has merit and should be considered for inclusion in a larger package.  Those larger packages are the bills that have nicknames and get all the attention – The Health Care Bill, The Climate Change Bill, The Stimulus Package.  In fact, staffers often refer to the end-of-the year spending bill as a “Christmas Tree” with lots of “ornaments” in the form of these smaller bills with large contingencies of support attached to make the bill more attractive.
The chairmen and subcommittee chairmen of committees of jurisdiction lead the process of drafting the large bills.  Usually for a large bill, the committee will dedicate days or weeks or months of hearings to gathering information about the topic, to hear different perspectives and to educate the members and staff. During these hearings, Members will raise concerns or express interest in certain policies, both to make their views public and to indicate to the chairman and staff what they would like to see in a bill.  Before drafting begins, there will likely be many meetings among staff and Members to discuss priorities, and attempt to reach consensus on an approach, within the committee, or at least within the majority members of the committee.
The staff then works on a format based on the input from committee members, directed by the Chairman.  Often this will include “picking up” smaller bills that have been introduced by committee members and including them in the legislation.  OLC then turns this format into legislative language and the vetting process goes forward. The draft language will likely go through many iterations, with many edits.  Edits to the document are done by OLC, usually only at the direction of the committee staffer that is in charge of that particular section.  When the bill is ready, it is treated just like the smaller bills, it is printed, signed, delivered to the Hopper, and given a number.
Summary
So here’s a summary of what Marci wrote: If you want to know who actually puts pen to paper, it’s nonpartisan staff lawyers who work for Congress who know the exiting law they are affecting inside out. They do that under the direction of office staff for Members of Congress and congressional committees, who vet the bill with outside experts and advocates. Sometimes those advocates (i.e. lobbyists) propose changes in the form of legislative language. But did they write the bill? Probably not.