TL;DR - Either step through the "Try It" install flow until the 04t ID appears in the Salesforce login URL, or replace appxListingDetail?listingId= with services/apexrest/v2/listings/ in the AppExchange URL to get the full listing metadata as XML.
The 04t ID is the Salesforce record ID for a specific package version. You need it to install a managed package via URL, script an unmanaged installation, or reference the exact version in a dependency. AppExchange doesn't display it on the listing page, but it's not hard to find.
Go to the AppExchange listing and click Try It (not "Get It Now" - that flow asks you to log in first and hides the URL).

Select Try in your sandbox (or whichever environment suits you) and click Continue to Installation.

AppExchange shows a confirmation page with the package name and version. Click Log In & Install.

Salesforce redirects to a login page for your org. Before you even log in, the install URL in the address bar already contains the package ID:
https://test.salesforce.com/install/installPackage.apexp?p0=04t...
The value of the p0 parameter is the 04t ID you're looking for.

Apply the following URL hack on the AppExchange listing URL and hit Enter:
Replace appxListingDetail?listingId= with services/apexrest/v2/listings/.
-https://appexchange.salesforce.com/appxListingDetail?listingId=a0N4V00000HA0X2UAL
+https://appexchange.salesforce.com/services/apexrest/v2/listings/a0N4V00000HA0X2UAL

The browser returns the full listing metadata JSON in a XML response - including the packageId field, which is the 04t ID.
