In the "Scramble for Africa" (from 1881 to 1914), the European powers were competing with one another to expand their empires and wealth and prestige.
Economically, they wanted precious metals and raw materials for industry.
As to the countries involved, all countries in Africa except two fell under the imperial influence of one European power or another.
In drawing boundaries on territories of their imperial control, the European nations were only concerned about agreeing between themselves on where those boundaries would land. They did not consider the ethnic or tribal divisions between native peoples in Africa. That obviously would lead to problems later on, as the new "nations" that were drawn up included people groups that were very much at odds with one another.