As far as I know Marx's answer to that question is simply: "Communism".
The more interesting question would be "What is Communism?" and in that regard Marx showed a profound lack of interest in speculations and instead afaik just postponed the question entirely to when capitalism is overcome. So the Marxist answer to what comes after capitalism, is essentially just "whatever comes after capitalism".
Afai understand it Marx had this idea that the social conditions follow the economic conditions and that progress is achieved by class struggle. So to an extend he took a large gulp from the kool-aid of the liberal narrative of his time and developed that into historic materialism. That is he bought the idea wholesale that the struggling underclass of merchants and craftsmen developed in the shadow of the empire until their own mode of production replaced the current mode of production in a violent revolution.
Which he projected backwards and also forwards in time. The idea being essentially that of leapfrogging. So an upper class dominates an under class but due to the under class doing the effective work and acquiring the skills to be in a position where they actually know better how to run a society, the lower class than uses these skills to advance past the upper class. As a result you have a new upper class and a new under class, but overall the economic and political standards of living have improved (as the new underclass is the former upper class and the new upper class is even better than the one before). Rinse and repeat.
So the logical conclusion that he draws from that is that the new under class the proletariat (workers) would succeed the current upper class the bourgeoisie ("citizens", as at first only the rich enjoyed that status). So idk those who work the engines will acquire the skills how to build them and become engineers themselves being able to build better and more efficient technology and thus again propel society forward to an even less hierarchical and even more advanced society.
Because the trajectory of historic materialism as Marx had drawn it, based on the liberal narrative, was one of progress, from the high gap between master and slave and the large discrepancy of the rule of one over the many, each step (according to the narrative) lead to an increase in capabilities and output as well as a decrease in social discrepancy, with the liberal revolution hailing democracy (with lots of asterisks...) as opposed to aristocracy. So Tyranny -> Monarchy -> Aristocracy -> Democracy (with only the rich being citizens) -> Communism. Which essentially in that progression would be a version of Anarchism, where the need of slaves, masters and any such classes would be obsolete, because the production is enough for everyone so the future of humanity would no longer be dictated by the need for survival but be in the hand of the people themselves who could decide that by themselves how they would like to tackle that, because the discrepancy between classes would have been made obsolete as the discrepancy between upper and under class would be leveled.
Now that was pretty optimistic and he might have given the liberal narrative a lot more credit than it deserved. You could also frame history as continuous exploitation and the narrative of the underclass overthrowing the upper class as a mere coup d'état rather than a revolution in which an already powerful upper class just demanded government privileges and afterwards reigned in pretty much the same fashion as before, just with thematic changes. The advancement from monarchies to aristocracies might have never happened but aristocrats might have invented the role of the monarch to begin with. The ascension of common people to the level of aristocrats might not have been their own merit but a mere necessity of logistics as large empires probably were a nightmare before spreadsheet calculations and speed of light communication. So middle management was needed and had to have some privileges to cope with their responsibilities.
In a sense we might have even regressed in that regard as the lord of a fief was kind of his own boss owning the realm, while the lord to Burger King restaurant might not even own the place and has a lot less to say.
So the change might happen mostly for a middle class while the actual under class might largely stay where they are marginally improving over time or regressing first when times get tough.
Or how change in societal structures might have come as a result of ecological disasters where the previously excluded had to take responsibilities and received powers because there was no one else to do.
There are a lot of narratives that you could construct, that would explain the progression of societies over time. Ironically the capitalist apologists are the once probably most keen on Marx's class struggle leapfrogging idea, just avoiding his name and thinking of it in terms of the individual rather than societies as a whole. Like their idea of a meritocracy is basically that those at the top are at the top because they are the best and if they weren't the best someone would replace them who would be even better. Hence: Progress.
On the other hand the "Marxists" usually found themselves most successful when they were able to promote a utopia to an underclass having hit rock bottom and where they interpreted the class struggle as a fight against an existing class rather than an attempt to leapfrog them before that actual clash. So in a sense that's not really "Marxist" and what they ended up with is often a dropin replacement of the former system with a different narrative or even a regression to a previous system.