Based on our experience in the case of smaller sites that are not administered on a daily basis, the search engine detects the presence of malicious code or suspicious redirects sooner than the site owner his/herself.
Anyhow, the owner will be aware of it in most cases, as he/she will sometimes "check" the page and if there's a Search Console account. It will indicate the problem. In most cases Search Console attack report can be useful as well. Once the bug is actually fixed, it is worth submitting it to Google on the correct form. With a quick bug fix, Google will remove the page from its own blacklist or not even take it to the list. Being on the blacklist would result removing the page from the results list by Google.
After troubleshooting the attack, it is recommended to monitor Search Console reports constantly, because if the attackers or attacking robots have infected something else too, it is easier to find out about it.