Happily began to be used in 14th-century English in two senses: the modern one, and one (also expressed by haply) which is now obsolete: "perhaps, by chance." This is the one to watch out for. Sometimes it is obvious that the modern sense can't be right. The word could only mean "perhaps" when the Provost says to the disguised Duke, "Happily You something know" (Measure for Measure, IV.ii.92). And when Baptista says to Tranio that they must find a secret place to talk, reminding him that "old Gremio is hearkening still, And happily we might be interrupted" (Taming of the Shrew, IV.iv.54), it could hardly mean that he is looking forward to an interruption. But note occasions when Shakespeare may be using the word with both senses in mind, as when Horatio says to the Ghost, "thy country's fate, Which happily foreknowing may avoid" (Hamlet, I.i.135).
David Crystal is author, with Ben Crystal, of Shakespeare's Words, published by Penguin