I imagine it depends quite a bit on the man. I get the impression that most men would do this as a result of not being serious about the relationship in the first place. They were probably putting on a show the whole time, and either they got what they wanted and see no further reason to continue, or they perceive that they will not be able to get what they want (or not within the time frame they want) and don't want to waste any more time.
I also notice that in many dating profiles I have seen over the years, many women are very adamant that a man not be boring, and likes to constantly try new things. I have seen many relationships, even marriages, end as a result of the woman thinking the man is too boring. The problem with a person who likes to constantly try new things, is that very often they also have the wanderlust and do not like sticking with the same thing for a prolonged period. One hazard of dating such a person is that there is a fairly good chance that they will rather shortly do what they have always done and move on to something new by their nature. The irony of this situation is that the person who is actively seeking out someone who mustn't be boring can in the end lose that very person as they themselves are perceived as boring. I imagine in these situations, what is going on in these men's heads is basically "nothing," at least with regards to the woman they just left.
Not all men are like that, though. Some men want commitment, and would never initiate a relationship unless they truly want to see it through. If this type of man ghosts a woman, then it is most likely because she did something to cause him so much pain that he virtually had no choice but to cut things off immediately. Particularly if the act the woman committed was so egregious that there is no way she could not have known how hurtful it would have been. In this case, there is no way he can rationalize or justify her actions, other than the idea that they were done in malice or at least total indifference. In this instance, I would say what is going through the man's mind after ghosting the woman is pain.
Hmm explains that explains a few things…the last guy was upset because I didn’t want to watch him and his ex have sex then he just did a 180 on me and was this to totally different person. I had been talking to this guy for two years off and on and we would talk every night for hours when we did finally date. He was a wolf in sheep’s clothing. The last one before that he just decided he doesn’t want to date me because he wasn’t sure what he wanted. He said he was jealous of my lifestyle and he wanted his own place. And the one before just totally ghosted. No explanation. My motto was shit or get off the pot and say what you mean and mean what you say. Don’t invest all this time and say/do beautiful things then change your mind. The problem is people are so fickle now days. I will make a situation awkward because I won’t say I love you back if I don’t feel it. I just don’t understand how someone can put in so much time and effort then change their mind or turn on you. It’s a waste of time. I think after this last one I’ve turned a little jaded towards dating and feel I can’t trust any man given my dating history. I tried looking for men from different backgrounds, interest groups, dating apps, you name it, I tried it all. And somehow I attract the projects or commitment phobes. Im an optimistic person and always see the bright side of things but this last one really through me for a loop. I know not all men are like this but the ones I attract seem to fall short. I think I’ve given up on dating and have no interest in it and turned a little cold by it all. Besides im happy being single and there is no way or statistically speaking I will not find my match. And I’d rather be single than deal with a miserable relationship. Sorry lol I got on my soapbox, it’s just frustrating and seems hopeless.