Socialism is a hat which was tried by the different sized heads ultimately resulted in losing its original shape. Its inception dates back to the French Revolution, though in true sense it never came into force because society wasn't known to such kind of radical ideas in government.
Keeping pace with the time socialism adapted itself to the situation, and with the advent of industrial revolution and demand for workers right and life of dignity, socialism started getting familiar with common masses. However, most significant thrust came after the coming of MARXISM by Karl Marx; Marxism is a special variant of socialism which never came into being in the real sense because it was too idealistic to create a classless society and no one was able to implement it in a way Marx wanted. Or even another side could be that Marxism isn't tried system in true sense.
USSR was a synonym of the communist regime and undisputed leader of the communist world. Lenin with his variant brought revolution in Russia, but he didn't follow Marx ideology after coming into power and instead became the dictatorship of the communist party. With Stalin, Brezhnev, and Khrushchev its ideology varied, but in the end, it failed. With the collapse of USSR due to the cumulative effects of high fiscal debt, aggressive policies in the Cold War, non- competence among industries. Overall it started getting resentment with stagflation in the economy. People were amazed to see the rise of the capitalist world. Hence, communism was rejected by the people.
Third world countries were in love with the concept of socialism because it gave them sigh from colonial powers which were capitalists in nature. Therefore, it was a natural choice for them to opt for socialism. However, it didn't go well in the long term as it was made to change with structural adjustment program in the economy. Even today be it in China which is no real sense socialist but purely capitalist in true sense since reforms initiated in the late 70s. In the case of North Korea which at present stand as a pariah state and on the verge of failure because in no reason there is socialism but a hereditary monarchy.
India adopted for democratic socialism another variant of socialism, but it faced challenges in the economy and changed its orientation with economic reforms of 1991.
Be it Marxism, Soviet Communism, Guild socialism or Fabian socialism these ideas appealed to people but just out of anger against an existing form of government. Even socialism wherever applied, it wasn't able to bring those changes for which at first place it was thought. However, we should see the example of Botswana in Africa, which has a good repo in education and health when its neighbours are still suffering from acute poverty and unemployment. Therefore, socialism in itself is not a failed concept, but it is made to fail.