If you break those rules, even innocently, the FAA can come down hard on you by revoking your license and fining you thousands of dollars. Depending on how sensitive the area is and how suspicious you appear they can send other aircraft to your location and (in the case of the DC FRZ) potentially shoot you down. Once you've been indoctrinated into the system you learn to be extremely aware of where you are, what is nearby, and to stay away from sensitive areas.
*There are ways, at least for private pilots, to legally fly over a lot of restricted areas but it's much easier to just fly around them or not bother.