Let me make a further statement: Improvisation of rules is not very thoroughly theorised, taught, or even talked about, whenever anybody grapples with the issue of "how to be a good GM" or, more fundamentally, "how to make games fun".
Let me make a concluding statement: There is a good reason for this.
In the intro to the 2nd edition AD&D Dungeon Master's Guide, we find Zeb Cook giving probably the best GMing advice that I can think of:
The Player's Handbook and the Dungeon Master Guide give you what you're expected to know, but that doesn't mean the game begins and ends there. Your game will go in directions not yet explored and your players will try things others think strange. Sometimes these strange things will work; sometimes they won't. Just accept this, be ready for it, and enjoy it.
Take the time to have fun with the AD&D rules. Add, create, expand, and extrapolate. Don't just let the game sit there, and don't become a rules lawyer worrying about each piddly little detail. If you can't figure out the answer, MAKE IT UP! And whatever you do, don't fall into the trap of believing these rules are complete. They are not. You cannot sit back and let the rule book do everything for you. Take the time and effort to become not just a good DM, but a brilliant one.
To repeat: Take the time and effort to become not just a good DM, but a brilliant one.
Coming as it does at the end of these two paragraphs, the implication of this sentence is clear: Zeb believes that becoming "a brilliant DM" is directly connected to having fun with the rules; adding, creating, expanding, and extrapolating; and making up the answers to things. I agree with this - it does. But there is another implicit question which Zeb doesn't answer: How is possible to get better at all of this?
That's not a question which is easily answered, because I tend to think that GMing is basically a form of tacit knowledge, and being able to improvise rulings is perhaps the area where this is truest. Improvising rules in ways that are fair, interesting, and workable is not a skill that can really be learned from a book. It's something that has to come through experience. To borrow an analogy from Michael Oakeshott, being a good GM is rather like being a good chef. There is a set of rules, which are like a recipe. But creating a really tasty dish is much more about the feeling and intuition gained from years of cooking than it is about slavishly following the recipe. Strict adherence to the recipe will get you so far, but proper chefs have the experience and know-how to take the dish to a level far higher, and often if you ask them why they are doing what they are doing, and what rules they are following, they'll find it difficult to tell you.
GMing is similar. A good GM probably isn't particularly aware why they are doing the things they are doing (beyond the obvious awareness that they're doing it "because it works"), and if asked to write down a "good GMing guide" they would probably not be able to produce anything particularly coherent or enlightening. This is especially true when it comes to improvisation. I'm sure you all know GMs and players who are good at this - but try asking these people to explain how they got good at it, or what principles they apply. Probably, they won't be able to do that. Probably, they're just good because they have a lot of experience in GMing, giving them an intuition for what will work, and the tacit knowledge of how to pull it off.
In a sense, this reinforces Zeb Cook's advice, and perhaps shows it in an even better light: Take the time and effort to become not just a good DM, but a brilliant one; or, in other words, develop your tacit knowledge and intuition for improvisation through continual play.
(Edit, because I think it was unclear in the original post: Let me emphasise that I am talking about improvising rules for situations not covered in the game text, rather than improvising content - like NPC personalities or settings. I think the latter is more easily taught than the former. The paradigm example of what I am talking about would be what crops up in this post: There is an elf who might try to sneak up on the PCs' campsite during the night. One of the players decides his character will put coins on the tops of rocks, as a primitive alarm system which will make a noise if the elf knocks them over. Rules improvisation on the part of the DM here is crucial - he needs to decide how he will adjudicate the success of this. And to do so successfully he needs tacit knowledge.)