This started with Mac OS Mojave, and still happens occasionally. A message something like "A problem occurred: The web page couldn’t be loaded" is displayed.
This is a quick workaround for that malfunction. Once you connect to the public wifi instead of a captive window an error shows up: "A Problem Occurred. The web page couldn’t be loaded"
There seems to be an issue with displaying the captive screen within the integrated browser. Open up another browser, like Safari and bookmark/open the following page:
http://captive.apple.com
It might be necessary to refresh this page multiple times until the correct captive screen will be shown. But after a few retries you should be able to authenticate.