I've seen both situations occur.
Right off hand I would guess that the presence of pheromones from a nearby male may stimulate her to ovulate, but the actual stimulus to go through the motions and drop infertile eggs without being introduced to a male is not known to me.
Actually the entire mechanism is kind of a mystery to me. I once heard a talk by Dave Barker about pythons where he went into the biology of ovulation. His comment was that it is not possible for the oviducts to reabsorb follicles. Which does make a lot of sense to me. But many of us that have been breeding snakes for a while have certainly seen cases of obviously gravid females that never laid eggs and apparently reabsorbed those 'eggs'. But what really happens, I don't know. I have the complete set of books, THE BIOLOGY OF THE REPTILIA, but so far the osmosis process for that knowledge to seep into my brain just hasn't happened.
As an aside, I have had a female drop fertile eggs just 19 days after her one and only introduction to a male, so evidently there must be a fairly reasonable amount of time from initial ovulation to the 'deadline' when the eggs CAN be fertilized. Certainly there must be a limit to when a female can mate and have the eggs fertilized. But I couldn't tell you what that limit is.