How did the Blacks gain political power from slavery

As we all know, our president today is a black guy, but throughout American history, blacks were considered inferior, how did black people gain their political power from slavery by steps