Historically, hopefully means in a hopeful manner and should not be used similarly to the German hoffentlich (i.e., as a synonym for I hope or let’s hope). Using it in the latter, newer sense has been long considered uncouth but has also done away with any common knowledge of the original sense.
But the newer use, which has been around since at least the 1960s (when it was considered taboo in most writing), is now accepted in the AP Stylebook and in colloquial American English, where it appears with such abundance that any fight against this linguistic change is moot. If you do use hopefully in your writing, do not use it ambiguously: John will hopefully come home can mean that John is hopeful he will return home or that the speaker is hopeful that John will return home. A better alternative might be I hope that John will come home.
Despite its prevalence in colloquial English and acceptance in journalistic English, avoid this word in formal writing. Used correctly, it may still pause a reading, especially for usage experts who may assume its use is incorrect; used incorrectly, it will lower the writer’s credibility among careful readers. Prefer I hope to Hopefully, as such phrasing does not hide the subject doing the hoping and also avoids potential ambiguity.
Whatever you do, do not use It’s to be hoped, a prolix, passive alternative.