The question of Elvish fates is dealt with here, so I'm going to focus on Men (and, by extension, Hobbits).
There is an afterlife, but nobody knows anything about it:
What may befall their spirits after death the Elves know not. Some say that they too go to the halls of Mandos; but their place of waiting there is not that of the Elves, and Mandos under Ilúvatar alone save Manwë knows whither they go after the time of recollection in those silent halls beside the Outer Sea. None have ever come back from the mansions of the dead, save only Beren son of Barahir, whose hand had touched a Silmaril; but he never spoke afterward to mortal Men. The fate of Men after death, maybe, is not in the hands of the Valar, nor was all foretold in the Music of the Ainur.
The Silmarillion III Quenta Silmarillion Chapter 12: "Of Men"
There's evidence that the souls of Men spend at least a little time in Mandos; Beren did so, before he was resurrected:
[T]he spirit of Beren at her bidding tarried in the halls of Mandos, unwilling to leave the world, until Lúthien came to say her last farewell upon the dim shores of the Outer Sea, whence Men that die set out never to return.
The Silmarillion III Quenta Silmarillion Chapter 19: "Of Beren and Lúthien"
But after that, all we know is that they eventually leave the world, presumably to go hang out with Ilúvatar; this is in comparison to the Elves, who even in "death" are bound to the world until its end:
The Doom (or the Gift) of Men is mortality, freedom from thecircles of the world. Since the point of view of the whole cycle is the Elvish, mortality is not explained mythically: it is a mystery of God of which no more is known than that 'what God has purposed for Men is hidden': a grief and an envy to the immortal Elves.
The Letters of J.R.R. Tolkien 131: To Milton Waldman. 1951