A market on close order is usually an order that is reversed for the closing auction.
When such orders not designed by exchanges, brokers are emulating them.
For instance, if an exchange does not provides this feature inside its matching engine, your broker can build a mechanism that will retain your order up to send it to the exchange just at the start of the closing fixing. In such a case: if your broker has an IT/network issue, your order will never reach the close. Keep in mind that some exchanges do not have auction calls for the fixing (India for instance).
Market on close are usually market orders: whatever the price at the close they will accept it because implicitly they assume you want liquidity, not a good price.
Nevertheless some exchanges accept limit prices for market on close, to prevent you to have an awful price if the price really goes away during the closing auction. There is a lot of information about this in Market Microstructure in Practice (2nd Edition) L and Laruelle, section 2.1.1.
From the boo, here is the typical flow of orders arriving for the close during the pre-fixing (horizontal axe is in minutes, vertical axe in quantity):
It is not the same as target close algos, that are all designed by brokers, and have the discretion to create child orders, sending some of them before the close and others at the close. Thus your price will be the average of all this child prices.
Similarly, you can try to obtain a price improvement by not trading everything at the close, but wait more (this is an implicit suggestion in your question). And you are right to try to understand what would have been your price at the close: it is good to have a benchmark, to compare your execution to.
In your question you mention that
If I'm entering into a Market order to buy (e.g., for a share of SPY), it's easy to see the spread that I am crossing: I can compare the "mid" average of the NBBO to the ask, and that's the spread I paid.
I am not sure that it is that easy even in continuous trading:
- what if you would have wait to send your order (opportunity cost)?
- what if you would have split your order in two smallest ones, waiting for new liquidity to come in the orderbook (liquidity cost)?
These questions is indeed the same for orders sent during the continuous and fixing sessions.
These questions imply that it is difficult to have a benchmark because once you interacted with other market participants (via the orderbook), you changed their reaction and "what if I would have done something else?" scenarios are very difficult to assess.
Nevertheless there is no "bid-ask spread" during the prefixing, but they are two overlapping orderbooks: the one of the buy orders and the one of the sell orders. This is the imbalance between there two orderbooks that will form the price (in a Walrassian equilibrium manner). Hence after the close, you have the "next closest buying price" and the "next closest selling price" that you can use like bid and ask prices. Be careful that in most cases, not 100% of the offer or demand has been cleared at the close price, hence there is a signed remaining quantity, that you should take into account.