This is a very complex question; I'll see if I can help.

Before I begin though, let me just say that you could take an entire undergrad and postgrad course on the economic, social and political development of Africa, because non-African nations have almost as much to do with the current state of Africa as the African nations.

Let's start by addressing why some countries are poor.
There are many reasons some countries are poorer than others, and I would hate to over-generalize, but I'm going to. Access to International Trade, having resources worth trading Internationally for, the domestic resources available to develop a valuable workforce and a stable and effective form of governance.

Generally speaking.

Malawi for instance. Even if it had some tremendous resource it could sell in International markets, there aren't any regional buyers to pay for the development of further infrastructure. It doesn't have direct access to major trading centers and routes. If it wanted to develop a workforce to export something of value that wasn't dug up from the ground, it would need investment in order to pay for the education, infrastructure, etc. And that gets us into foreign aid and development banks, but we're just going to avoid that for now.

But even if it had all of that, the purchasing power of International markets greatly effect the International distribution of wealth.

Great example: The U.S. is one of the top oil-producing countries in the world. Despite this, we continue to import almost all of our oil. Why is this? Because American energy companies make more money by selling our oil internationally than they would domestically, so they do, and we end up buying cheaper oil from somewhere else.

Even if Malawi was swimming in some resource, maintaining domestic ownership of said resources and making it cheap enough to compete with countries that heavily subsidize certain industries can make it impossible to repeat.

Another great example of this: NAFTA.

The North American Free Trade Agreement is a FTA between Canada, U.S. and Mexico. We promised Mexico that by enacting this agreement, American companies would move all their factories from Asia to Mexico, employing millions. What happened though was that even after NAFTA, it was still cheaper for us to manufacture in Asia. But what the U.S. and Canada got in exchange for the "promise" was the removal of import tariffs on Financial Capital and Corn, among other things. As it happens, the U.S. subsidizes the Corn industry here to the tune of $9-12b per year.

As a result, it became cheaper for Mexico to import Corn from the U.S. than it was to buy domestically. And in case you don't know this, Corn ("maize") is a huge staple of Mexican agriculture. They make everything out of corn. So now, all of a sudden, Mexico has millions and millions of unemployed farmers. Who do you think has been rushing to the American borders all these years?

On top of that, by allowing us to freely invest in Mexican companies without tariffs, American banks purchased controlling interests in almost all of Mexico's highest-grossing companies. So anytime a Mexican company makes money, the revenue flows back to NYC, rather than back into Mexico.

I tried to keep that simple and direct. I'm sure I missed some details on a lot of that, so please correct where I erred.

Hope this helped!