From An introduction to Greek and Latin palaeography : Thompson, Edward Maunde, Sir, (1912), pp. 61–62, My summary:
The breathings and accents were invented by Aristophanes of Byzantium, ca 200 BC—when the breathings and accents were still being pronounced. It is believed that they were promoted for the teaching of literary Greek, precisely because they were starting not to be pronounced.
Accentuation is not used at all in non-literary papyri, and only occasionally in literary papyri. By the 3rd century AD, their use had become systematic in literary papyri. When the transition was made to codices, they were dropped again (although they are added in to the early codices of the Bible); and they were not systematically resumed before the 7th century AD.
So, if the question is about why they were dropped in the 3rd century and resumed in the 7th century, well, not sure. The how though is not difficult: manuals of accentuation were written in Roman times, by grammarians such as Aelius Herodian, and had been preserved. Scribes just started paying attention to them again.
Iota subscript – Wikipedia, as Joe Venetos indicates, gives an account of its history. The iota subscript was invented in the 12th century AD; it had not been pronounced for the previous 12 centuries, and was only intermittently written as a silent letter. Again, the grammars and dictionaries had recorded where the silent iotas were supposed to be, and the scribes then decided to write it down as a diacritic instead.