Auto assignment is based on the closing price on the day of expiration. But where it gets a little murky is that the option buyer has that narrow time prior to the deadline where he can look at things like after hours or earnings releases and decide to do something different than what the auto assignment would do. This is why closing options rather than letting them expire is often a good idea. Then you are sure a surprise can’t happen after market close.
It is determined by the 4pm et closing print on the primary exchange. Note that this closing print may not come at exactly 4pm, may be a few seconds later (or longer in extreme cases, such as the day TSLA was added to the S&P.) If options are in the money by .01 based on this price, they will be auto exercised (unless an exception is filed)
I guess I did not exactly answer you. As was answered, it is based on the 4et closing of the markets but as stated that sometimes is delayed due to high volume days etc but is generally at 4et.
I find from experience that when short option the 4pm print can't be replied on at all to determine if option will be exercised when strike is pinned.