How do "Order Types" and "Order Item Types" work? I'm using the Commerce framework. I'm trying to understand exactly how &quot;Order Types&quot; and &quot;Order Item Types&quot; work. (I've consulted the docs; they don't really address this question.)
So far, I've deduced that:

The Checkout Flow that Drupal uses is determined by the Order Type that's in play.
Every Order has an Order Type.
Every Order Item has an Order Item Type.
Every Order Item Type belongs to an Order Type.

...but that's as far as I've gotten. I'm trying to understand:

What rules does Drupal use to decide which Order Type it's dealing with? (That is, how does it know which Order Type is in play?)
At what point in the is this decision made? (When the user first adds an item to their cart? When they begin the checkout process? At some other point?)

Thanks!
What rules does Drupal use to decide which Order Type it's dealing with?

That's determined by order type resolvers (implementing OrderTypeResolverInterface in this case). Such resolvers are given an order item, and must use that to determine the type of order.
Out of the box, the default resolver (DefaultOrderTypeResolver) uses the bundle of the given order item, which will be an order item type ID, to load that item type entity, and get the associated order type ID from it.

At what point in the is this decision made?

There are probably multiple places that decision is made (creating orders in the admin UI for example), but in terms of the cart, it happens when the cart is created, which in turn happens when an item is first added to it via the standard AddToCartForm submission.
So I think it's fair to say that the type of an order that originated from a cart will always be the type associated with the first item that was added to it.