The Esri documentation now specifies this exact case, with an inset box that states:
If your PostgreSQL database cluster is listening on a port other than
the default (5432), include the port number in the instance. For
example, if PostgreSQL is installed on server mamabear and is
listening on port 49200, type mamabear,49200 in the Instance text box.
In general, PostgreSQL is the easiest database for ArcGIS client connection, because the DataStore utilizes PostgreSQL, so the client libraries are included* within the ArcGIS installation. The only real trick is properly configuring the PG server to listen from the network from which you are connecting (which could involve both
pg_hba.conf within the server instance, as well as the firewall configurations on both server and client).
If you can't get Desktop to connect, you should:
Check the System Requirements from the Esri documentation, to make sure it's supported combination
Install a 32-bit PostgreSQL client and play with firewall and/or server port properties until you can successfully connect via
At this point, a new ArcGIS Desktop or standalone ArcPy session should connect with ease.
WARNING: Please note that you shouldn't EVER connect from ArcGIS to PostgreSQL as the
postgres user. There is no reason to do this and every reason not to. Check out any book on PostgreSQL (or any database, really) and they will always tell you to create logins for your project. Using the administrative login for just about any task except creating new logins is a disaster waiting to happen!.
*Caveat: The 10.4.1 installation of 64-bit Background Geoprocessing had a bug that left out a required
libintl-8.dll file from the bin64 folder. This Geonet blog post has details on the problem. You can contact Tech Support for the QFE (the problem is fixed at 10.5.x).