APK is an archive format used for distributing Android apps. It is based on the Jar format (for Java), and like that format, is actually a ZIP archive with a different extension, and with specific files and directories within it.
Metadata about the app is in a META-INF directory within the archive (similarly to Jar files), compiled code is in a lib directory, and resources in a res directory. There are also a few files at the root level including AndroidManifest.xml (which may be regular XML or, often, binary XML).
Downloading APK files locally from Google Play
By default, Google Play only allows Android apps to be installed directly to a device, with no support for downloading the APK locally (e.g. from a Windows or Linux PC). In the following two workarounds are described. Note that these may well violate Google’s Terms of Service.
Option 1: APK Downloader website
The easiest option is to use the APK downloader website, which allows you to download (free) APKs without the need to log in to Google:
However, this does not appear to work in all cases (and obviously it won't work for non-free apps).
Option 2: APK Downloader extension for Chrome
An alternative is the APK Downloader extension for the Google Chrome browser, which adds a Download APK button to the Google Play interface (for this you need a Google account). It can be obtained here:
Upon using the extension for the first time, you need to provide your Google username, password and an Android Device ID. The latter is linked to a specific device (see below on what to do if you do not have a device, e.g. because you're running Android in an emulator). Entering the required details may result in a login error (username / password unknown), followed by a blocked a sign-in attempt notification from Google. This can be resolved by enabling access for less secure apps from the Google account settings. Details on this can be found here.
Obtaining the Android Device ID
If you don't have an Android Device ID, you can obtain one by running a (virtual) instance of Android. The best option here is to set up Android on a virtual machine using VirtualBox. For Windows users a simpler alternative is the Blue Stacks App Player, which can be downloaded here:
However, after a day or so the Player will stop working, unless you either pay a monthly license or accept the installation of sponsored apps.
After installation, start up the player and enter "device id" in the search field (see also step 2 here. Install and then run the app, which will give you a Device ID that can be used to unlock the Download APK extension as described above. Note that you can use this Device ID on any other machine (it is not tied to the machine on which the Blue Stacks App Player is installed).