Mark Wagner has pulled together web wide resources, and added his own insights, to a thoroughly well written piece on best practices when making changes to the web.config file. I placed a bookmark on it earlier in the week after hitting an issue where changes in some code I was reviewing did not seem to be propagated across all servers in a farm, a quick read of his post helped me identify exactly why.
SharePoint 2007 (WSS and MOSS) allows you to easily and safely add and remove modifications to the web.config file. This post briefly covers what the SPWebConfigModification class can do for you, and how to best to use it.
Thanks Mark: How To: Modify the web.config file in SharePoint using SPWebConfigModification