this is an indirect discourse dependent upon a verb in the past tense, therefore it is in the optative; as for guetter it means something like watching something with apprehension.
To add to what Constantinus said (and it could be that I’m not reading it right), ὅ τι εἴη τὸ αἴτιον is an indirect question (the direct question would be “What is the cause?”, τί ἐστι τὸ αἴτιον;) introduced by ἐξηῦρεν. Because έξηῦρεν is a “historic” tense, the indicative can (optionally) be changed to the optative.
To me, for whatever it’s worth, it looks more like a relative clause than indirect speech. What Goodwin classes under “General conditional relative sentences.”
See Goodwin 537 on these sentences with ὅστις
The indicative is generally used in Greek (as in Latin) in parenthetical relative clauses, like ὅ τι ποτ᾿ ἐστίν, whatever it is (quidquid est), ὅστις ποτ᾿ ἐστίν (or ἔσται), etc…
But ὅστις in such expressions can have the construction of an ordinary conditional relative, so that in future and general conditions it may take the subjunctive. E.g.
Ἀλλ᾿ ὁ προσαψάμενος αὐτῶν, ὅστις ἂν ᾖ, λόγον παρέχει, > but each one who has to do with them, whoever he may be, gives his own account of them. > Aeschin. i. 127. Ἀλλ᾿ ὑφ᾿ ὑμῶν ἔδει κεχειροτονημένον εἶναι τοῦτον, ὅστις ἂν ᾖ, > but this officer ought always to be elected by you, whoever he may be. > Dem. iv. 27. See Theog. 964.
This gets you to subjunctive, and the optative follows from the secondary tense of ἐξηῦρεν. (See Goodwin 532.)
I’d be very interested in how precisely you distinguish these from Goodwin’s “ὅ τι ποτ᾿ ἐστίν” parenthetical relative clauses. Edit: looking at it, Goodwin appears to base it on their being a parenthetical aside, rather than an object of a verb.
In all Goodwin’s examples the clause is parenthetical. That’s not the case here. ἐξηῦρεν ὅ τι εἴη τὸ αἴτιον is just a straightforward indirect question, “she found out what the cause was.”