Sometimes candidates will try to appeal to a particular demographic group or will try to make up for a perceived weakness by choosing a particular running mate.
Barack Obama's selection of Joe Biden as his Vice President is often considered a way to augment a lack of foreign policy experience (Obama) with the Chair of the Senate Foreign Relations Committee (Biden).