In these sentences, do agrees with the subject noun phrase, which is between it and write. The subject noun phrase in (1) is any of the students, and in (2) is anyone. Anyone is obviously singular, so it gets does; but any of the students means '1 or more of the students', which is plural, so it gets do. NPIs like any often appear in questions, and when they do, they can cause problems in agreement.
– John LawlerOct 12 '17 at 16:42
@EdwinAshworth: 2 is not answered by the linked post by nohat. Verb agreement and the use of "singular they" are two separate things: we can refer back to an indefinite singular noun phrase like "a student" with "singular they" (example: "If any student forgets the homework assignment, they can check it online") but we can't use plural verb agreement for the verb after "any student" (*"If any student forget the homework assignment, they can check it online").
– herissonOct 17 '18 at 01:26