The author of the screen play was Michael Blake, who, two years earlier, at urging of Kevin Costner, wrote the novel Dances with Wolves. I know the question is about the movie, but I thought I'd talk about the original novel.
Below is cited from the novel:
Lieutenant Dunbar had it pegged better than he knew, because this
major had, for some time, clung to sanity by the slenderest thread,
and the thread and finally snapped ten minutes before Lieutenant
Dunbar walked into the office. The major had sat calmly at his desk,
hands clasped neatly in front of him, and forgotten his entire life.
It had been a powerless life, fueled by the pitiful handouts that come
to those who serve obediently but make no mark. But all those years of
being passed over, all the years of lonely bachelorhood, all the years
of struggle with the bottle, had vanished as if by magic. The bitter
grind of Major Fambrough's existence had been supplanted by an
imminent and lovely event. He would be crowned King of Fort Hays
sometime before supper.
A few paragraphs later:
"I'm in a generous mood and I will grant your boon. A wagon loaded
with goods of the realm leaves shortly. Find the peasant who calls
himself Timmons and ride with him." .... "My seal will guarantee your
safe conduct through one hundred and fifty miles of heathen
territory."
Finally, several pages later:
Old Major Fambrough, a midlevel administrator with a lackluster
record, had gone off his rocker. He had stood one afternoon in the
middle of the parade ground, jabbering incoherently about his kingdom
and asking over and over for his crown. The poor fellow had been
shipped east just a few days ago.
In the novel the major is described twice as "the liquor-breathed major." That's all. he had a "lonely life."
I believe that it was all of the above combined with absolutely no one to talk to. The enlisted soldiers are all described in ways as to indicate they are more or less illiterate. Being the Camp Commander ensured that his lonely life would remain so.