Detailed instructions can be found here: https://stanford.box.com/v/I-539instructions
Dependents of H-1B and O-1 employees who have entered the US in H-4 or O-3 status or who have changed to that status from another non-immigrant status may remain in the US until the end date noted on their last I-94 record. If the H-1B or O-1 employee extends his or her H status, the dependents must also extend their status by concurrently submitting a request for an extension. Dependent H-4 and O-3 students are permitted to study in the US but they may not work. H-4 and O-3 status expires for children at the time they reach 21 years old.