Richard Cory committed suicide because, despite all the things he had, his life was empty. The poet's message in the poem is that the traditionally sought-after objectives in life - social stature, money, and material comfort - are not enough to make life meaningful.
Richard Cory appeared to have it all. Everyone wished "that (they) were in his place". He was "a gentleman from sole to crown", and he was good looking, "imperial and slim". Not only that, he was dignified and classy, "quietly arrayed" and "skilled in every grace", and he was nice as well, "human when he talked". People were in awe of him; like celebrities of our time, "he fluttered pulses when he said "Good morning". And best of all, he was "richer than a king".
The speakers in the poem are not so fortunate. They must toil hard just to get by, "work(ing) on and wait(ing) for the light". Their lives seem like drudgery, nine to five, probably surviving paycheck to paycheck, but they have no choice but to labor on. They look at Richard Cory with awe and a little envy, hoping one day they can be just like him, because he seems to have everything.
The poet doesn't flat out state why Richard Cory killed himself. He makes a pretty clear case though, for the position that all those things he has that everyone else wants are not enough. He is "human", but although people admire and envy him, they do not connect with him on a personal level. He lives in loneliness and isolation, and, despite his material possessions, his life is not worth living.
Richard Cory committed suicide because, despite all the things he had, his life was empty