Re-installing OS X with apartment Wi-Fi
First I'd try to just connect to the Wi-Fi network and then run the recovery. But this will not work if you have a new and empty hard drive (i.e. no OS X  recovery partition on the hard drive) and need a full Internet Recovery from Apple's server.

If it doesn't work, I'd try and connect the Mac to another Mac or a Windows PC using a common Ethernet cable (network cable) and enable "Internet Sharing" on that system. On a Mac, Internet Sharing is simply enabled via System Preferences > Sharing. I don't know how this is done in Windows.

If that doesn't work either, I'd simply see that I connect the Mac to a different Wifi or ethernet-based network that doesn't require you to go through such a captive portal. Just remember not to enter any account credentials over public Wi-Fi (such as your Apple ID).