Extraction of a metal from its ore typically involves removing oxygen from metal oxides.
If the ore contains a metal which is below carbon in the reactivity series then the metal is extracted by reaction with carbon in a displacement reaction.
If the ore contains a metal which is above carbon in the reactivity series then electrolysis (or reaction with a more reactive metal) is used to extract the metal.