Wednesday’s surprise announcement of the departure of Yahoo’s chief operating officer, Henrique de Castro, represents a setback for Mayer, who signed him to a $58 million deal just 15 months ago to help her lure more advertisers to a company that has been struggling to compete against Google Inc