8 - How to Get Values From $variables hook_preprocess_commerce_order_receipt?
How do I get the order_id from this $variables object?


All entities have an id method, inherited (or perhaps overridden) from Entity::id. From your debug output $variables['order_entity'] appears to be one such entity, so:

$order_id = $variables['order_entity']-&gt;id();



  How/where did you find this information telling you how to get this value out?


Short answer, in the source and the docs (following/finding isn't always straightforward though). For example if you've read the Introduction to Entity API in Drupal 8, you'll intuitively know that a Drupal\commerce_order\Entity\Order is an entity type, both by the folder structure and its annotation, and you can start thinking about how to address an object of that type in more generic terms. 

That leads to searches like "Drupal 8 get entity id" or "Drupal 8 get entity field value programatically", and Google will dutifully tell you everything you need to know.

If you can spare a bit of time to follow the class hierarchy up the chain, and get at least a broad idea of what each class does and how it works, that will probably take some pain out of future encounters with the entity API too.