What happens if you are flying along through a Restricted Area (lets assume you're in a J-3 so you're VFR/no transponder, but you have a handheld radio to talk to ATC with) and said restricted area is activated while you're still in it? Would this be considered an operational failing on ATC's part, or would such a thing be blamed on the using agency (i.e. they ought to ask ATC "is anyone using this?" before they take it "hot")? Are there procedures you should follow in this scenario, other than "fly out of the restricted airspace the fastest way possible and hope whatever hazard caused the R-area to go hot doesn't hit you?"
Assuming your question is for the US airspace.
When the activation periods cannot be totally anticipated, the description of the area must reference the possibility of activation announced by NOTAM.
The NOTAM notice is normally not shorter than 4 hours before the activation.
While IFR flights will be prevented by ATC to enter or transit an active restricted area, non-controlled flights are under the sole responsibility of the pilot, as regard to flying within a restricted area.
A VFR pilot must take NOTAMs for restricted areas into account when preparing the flight (FSS), and should contact ATC when airborne for confirmation of the activation status.
From the pilot standpoint
You should not enter an inactive restricted area without contacting the controlling agency.
Penetration of restricted areas without authorization from the using or controlling agency may be extremely hazardous to the aircraft and its occupants
You are not allowed to enter an active restricted area without prior permission.
From the Federal Register, 14 CFR Part 73, §73.13:
No person may operate an aircraft within a restricted area between the designated altitudes and during the time of designation, unless he has the advance permission of (a) The using agency described in §73.15; or (b) The controlling agency described in §73.17.
FAA ATC, as the controlling agency, manages restricted area transit or avoidance, based on activation status, but only for IFR flights.
A pilot of a non-controlled flight (e.g. VFR) has the sole and complete responsibility for getting all information about the restrictions that may apply during its flight over a restricted area.
The briefing with FSS should include such research, contacting ATC prior to entering the restricted area seems the minimum.
From controlling / using agencies standpoint
A restricted area is part of the SUA (Special Use Airspace areas), and is jointly managed by Using and Controlling agencies.
Procedures for handling airspace matters, 21-2-4, Times of use:
a. The times of use indicate the period during which the using agency is authorized to schedule and use a SUA area. These times should reflect when normal operations are expected to occur. In determining the times of use, the proponent should select the minimum period needed to meet the using agency's requirements. The goal is to capture the majority of the day-to-day activities. When the using agency has a requirement for intermittent, less frequent use of the airspace (outside the specific published timeperiod), a provision to activate the airspace by NOTAM may be stated in the SUA legal description.
What does that say? If some periods of activation cannot be anticipated, the phrasing "by NOTAM" must be used.
- NOTAM activation. Use "By NOTAM" or "Other Times by NOTAM" to indicate when a NOTAM must be issued in order to activate the area.
Regarding the notice prior to activation by NOTAM:
(e). NOTAMs should be issued as far in advance as feasible to ensure widest dissemination of the information to airspace users. Normally, the minimum advance notice should be at least 4 hours prior to the activation time.
NOTE- Under no circumstances may SUA be activated by a NOTAM unless the words "By NOTAM" or "other times by NOTAM" are stated in the area's legal description.
A 4-hour notice is the minimum usually accepted for the publication of the NOTAM prior to activation of the restricted area. I assume the exceptions would be handled on a case by case basis.
An area without a NOTAM mention cannot be activated outside of the published periods.
R-2305 Gila Bend, AZ [...] Time of designation 0700-2300 local time daily, other times by NOTAM. Controlling agency FAA, Albuquerque ARTCC. Using agency U.S. Air Force, 58th Fighter Wing, Luke AFB, AZ.
It is extremely rare for an R-zone to be able to be activated by NOTAM with less than four hours' notice. Most R-zones in the U.S. are on a regular schedule printed on sectionals, with a few activated by NOTAM by the using agency with at least four hours' notice, and sometimes several days' notice is required by law for a few zones created along well-traveled Victor routes.
What's more common is an R-area that is activated, but "cold"; the hazardous or politically-important activity for which the R-zone was created and activated is not happening right now, and is not expected to begin happening in the time it will take you to traverse it. So, the using agency that controls the space while active lets you in and tells whomever is performing the activity requiring activation of the zone to hang loose until you're clear. While you're in the space, it should not be allowed to go hot; if the nature of the activity, or the communications between whomever's doing the activity requiring the R-zone and the using agency controller, is such that the using agency can't guarantee the zone stays cold, you won't be allowed to enter it in the first place.
A more common situation is a sudden "temporary flight restriction". These can be enacted by the FAA and similar agencies at a moment's notice almost anywhere they have jurisdiction, typically in response to an emergency situation. The airspace above a forest fire, for instance, can be declared off-limits within minutes of the fire being reported, as both a hazard to flight in several ways (hot, highly-turbulent, low-oxygen, low-visibility air for thousands of feet above a major burn) and to allow firefighting aircraft to do their job. Airspace within nominal distance of an area of law enforcement activity can be cleared in a similar way, officially in the interest of pilot safety in case of weapons discharge, but just as often the real reason is to get news choppers away from the scene to minimize the chances of someone being shot or otherwise spectacularly killed on live TV.
If an unplanned TFR is activated while you're in the airspace affected, you may not know about it until you land unless you're in contact with ATC or are intercepted by another aircraft and contacted on GUARD. The normal procedure would be to exit the airspace quickly and safely; this can be facilitated by ATC, who can vector non-participating aircraft to the nearest border of the TFR zone while maintaining separation.
In my limited experience (MOAs only) the controlling agency—the center, usually, but could be an approach facility—will be the final in-the-moment arbiter of whether the using agency—the military—is allowed to actually take the airspace and make it hot, regardless of any prior coordination or NOTAM. If there is IFR traffic within the area they will not release it until that traffic is safely out of it. This release process involves the center controller coordinating with all nearby facilities whose airspace lies in or close to the area in question and asking their approval to make the area hot; any one of the surrounding controllers can deny the immediate release of the area.
Whether or not they would deny use of the area for a VFR guy would depend on the exact version of special-use airspace, whether the aircraft is receiving radar services or not, how easy it would be for them to exit the airspace, etc. At the very least, if you're on flight following and the airspace goes hot you can expect a heads-up call.