Notes from the Undergroundis a quite complicated piece of writing that requires a bit of untangling to find all of Dostoevsky's possible themes. It's much easier and probably more valuable to the reader if we simply consider the broad meanings Dostoevsky conveys through his Underground Man.
During Dostoevsky's lifetime, the rational philosophies of naturalism and scientism swept through Europe and Russia. These ideas appeared most specifically in Chernyshevsky's What Is to Be Done? , which advances a kind of socialist utopianism that Dostoevsky, though at one time he embraced, absolutely despised. Basically Chernyshevsky advances the notion that man is good, and when governed by reason and science, he can form an ideal society. The Underground Man, however, disagrees with the idea that he is simply a piece of material confined to act only according to the laws of rationalism. Dostoevsky held that man is irrational and even evil by nature, that he isn't predetermined to act in any way.
In many ways, Dostoevsky advances a kind of existentialism throughout Notes from the Underground. The Underground Man strongly attacks any notions of central planning as he throws rocks at the Crystal Palace of Chernyshevsky and others. Because our choices mean something, we have meaning too, Dostoevsky argues. Though the decisions we make may be irrational, and even wrong, they are still decisions of our conscious free will. This free will, Dostoevsky maintains, is the most advantageous advantage, for this separates man from the beasts, making him truly human, not just a piano key or an organ stop.
The necessary drawback to this free will, however, is the suffering that must indelibly accompany it. Yet to Dostoevsky, certain things are gained through such suffering that cannot be gained without it. Truth, for one, Dostoevsky suggests can only be a result of a kind of extensive physical and mental torture. The ultimate example of such beneficial suffering, such selfless love, however, is the crucifixion of Christ, who of course heaped a limitless benefit on mankind by sacrificing himself. Christianity, to Dostoevsky, defied reason: it wasn't reasonable for Christ to die on the cross, yet His death was the most "beautiful and sublime" thing imaginable. Though the Underground Man, as confused, alienated and alone as he is, certainly doesn't know what is to be done, Dostoevsky explains (in a later chapter of the book that the editors deleted) that his only answer is in Christian mysticism, not rationalism or scientism.