How do I tell which Nexus 5X 6P stock firmware variant to download? I need to restore my factory image, but there seems to be many version of the images: https://developers.google.com/android/nexus/images?hl=en 

This is for the Nexus 5x and 6p. How do I know which variant do I need to download? Where do I compare these variant numbers? And what is the difference from each image?
First, you must flash the appropriate image for your device. Flashing a 6P image onto a 5X will not work.

Second, pick which version you want (i.e. 6.0.0 or 6.0.1). Within each version there are multiple download options. These are the different monthly security updates. For instance, 6.0.1 has two options for the 5X - MMB29K and MMB29P. These always increase within the same version number (i.e in this case, in the last digit P comes after K in the alphabet; However, sometimes it increases more fundamentally, such as the change from MDA89E in the first 5X 6.0.0 to MDB08K in the next security update for 6.0.0 on the 5X. In this case it is the third digit which increases from A to B that is the fundamental change; But in all cases, they increase).

Generally, just grabbing the last option within the version is fine. If you grab a previous one, since it is a stock image, you will get a prompt for an Over-The-Air (OTA) update to the latest security patch anyways.