Molly Fulton asks via Twitter:
There are usually a couple of reasons that cookies will go flat. Let's take a look at the mechanics of a cookie first, then we'll get into what likely happened with yours.
A cookie generally starts out with some sugar creamed into fat of some sort. Creaming, in this context, means mixing in thoroughly, enough so that the sugar essentially disappears and the butter becomes visibly lighter in color and fluffier. This will make tiny holes in the fat, which, when baked, will become slightly-larger holes in the cookie. This change from tiny holes to slightly-larger holes is what provides some of the rise.
After that, you'll mix in your dry and wet ingredients. In the case of cookies, you aren't using much by way of wet ingredients. Generally, you'll have some eggs and often a flavored extract. You'll rarely need more liquid. The dry ingredients consist of flour and often some kind of chemical leavener (baking soda or baking powder). The leavener is where you'll get the rest of the lift.
Depending on your chemical leavener, you will either get bubbles created immediately when it's added to liquid, or you'll get bubbles when it gets to a certain temperature. For all the details on leaveners, check out my article describing baking soda and baking powder.
Finally, when you bake the cookies, a number of changes happen: fats melt, leaveners activate, air expands, starches gelatinize, starches set, and amino acids brown. How quickly each of these happen will have an effect on your cookies. Ideally you want your leaveners to activate while your fats are still somewhat solid, giving a chance for air to expand and then, when the starches in the flour gelatinize and then set, to ensure that all of that happens in the right amount of time. Finally, the Malliard reactions should cause your cookies to become golden brown and delicious. If it seems like a lot to keep track of, don't worry about memorizing it. I just want you to have an idea of what's going on so the recommendations will make sense.
What's most likely happening with your cookies is that your butter is melting before the other reactions have a chance to happen. This will happen if your butter was too warm before cooking. If your butter is too soft, then right on putting it in the warm oven, it will just melt the rest of the way and your cookies will spread. Then, by the time the other reactions happen, it will be too late. The way to fix this is to ensure that your cookies are chilled before you cook them, either by resting the dough in the fridge for a few hours or overnight before shaping and baking, or by forming the cookies then cooling the cookie sheet in the fridge for an hour. For more detail on keeping your ingredients at the right temperature, check out my article on ingredient temperatures, especially eggs and butter.
If you used a different fat, such as shortening or lard, then you would have a lot more leeway on the temperatures, and you would likely get taller cookies. The flavor would be very different. Especially with the lard.
Another possibility is that your oven temperature is too low. Ovens are notoriously unreliable in their temperature settings. Use an oven thermometer and get your oven calibrated if need be. If your oven temperature is too low, then the fat will melt slowly just as described above before starches can set. If it goes quickly, then rising happens, starches set, and all of that.
Finally, though this isn't likely the problem, if you are using baking powder, it could be past its prime. Don't let your baking powder sit around for year after year. It'll absorb moisture, activate in the can, and lose all of its rising ability.