The butter adds some flavor, but mainly it's there as a medium for the flour. In terms of thickening, the important part of the roux is the flour, or specifically, the starch in the flour.
Cooking a starch causes it to expand and gelatinize, absorbing liquid like a sponge. Think of the way rice or oatmeal absorb water and swell up when you cook them.
It's the same thing happening when you use roux to thicken a sauce, only the ratio of starch to water is much lower, so instead of getting a gelatinous mass, like with oatmeal, you get a sauce that is moderately more thick than plain stock, but still quite pourable.
It's this gelatinization effect by the starches in the flour which gives the sauce its thicker consistency.
Starchier flour, like cake flour, will thicken more than bread flour. But as a general rule of thumb, if you're using all-purpose flour, you want to use equal parts (by weight) of flour and fat.
What Does the Butter Do?
The traditional fat in roux is butter. Specifically, clarified butter, because it's had the water and milk proteins removed. Clarified butter will improve the roux's thickening power and it combines more easily with the flour.
The butter in the roux basically serves to keep the starch grains separate. If you simply added raw flour to your liquid, it would clump up and you'd get a lumpy sauce, not a smooth one.
So the starch is suspended within the fat, and the fat is distributed throughout the liquid, which in turn causes the starch to be distributed evenly, rather than clumping up.
Cooking the Roux
Another reason we don't add raw flour straight to the sauce is that raw flour tastes like raw flour. That's why it's important to cook the roux for a few minutes before using it in your sauce.
The longer you cook the roux, the darker it will get. Browning the roux adds a nutty, toasty flavor to it, as well as color, which is useful if you're making a brown sauce. But note that the longer you cook it, the less thickening power it has.
Finally, here are some guidelines for how much flour and butter you'll need for 4 cups of sauce, depending on whether you want a light, medium or heavy sauce. The liquid measurement refers to the final sauce. You might start off with more liquid and reduce it. The table below assumes you're using all-purpose flour.
For Each 4 Cups of Liquid:
- Light Sauce: 3 oz roux (1½ oz each butter and flour) (43 grams each)
- Medium Sauce: 4 oz roux (2 oz each butter and flour) (57 grams each)
- Heavy Sauce: 6 oz roux (3 oz each butter and flour) (85 grams each)
Also see: Thickening a Sauce with Cornstarch