Sacrificing Bishop for Two Pawns against Queenside Castling Though queenside castling is less common, it is important enough to study. If your opponent has castled queenside, sometimes you have an opportunity to expose their King by sacrificing your Bishop for 2 pawns, as showed below. (I have removed other pieces from the board to avoid distraction.)

[FEN "2kr4/ppp5/8/8/8/4B3/8/4K3 w - - 0 1"]

1.Bxa7 b6 2.Bxb6 cxb6 


What factors should one consider before deciding to offer this sacrifice? To put it another way, in what positions is this sacrifice favourable and in what positions would it be unfavourable?

Edit As per comment from xaisoft, I am posting a board with other pieces. 

[FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"]

1.e4 e5 2.d4 d6 3.Bc4 Nf6 4.Nf3 Nc6 5.dxe5 dxe5 6.Nxe5 Nxe5 7.Qe2 Bd7 8.Nc3 Qe7 9.Be3 O-O-O 10.Bxa7 b6 11.Bxb6 cxb6
I'd argue you never want to play such a bishop sacrifice if your opponent is willing to take it. 

Therefore, I think your question is rather “when can I take the undefended ♟ a7”.

To answer this, I'd say you need


Either a defense on the bishop (with a rook or a knight)
Or a crushing attack if you can sacrifice it. A queen around, or a rook coming on the open c-file, with pieces supporting that are mandatory. If the king can't easily escape to e8, that's better.
Nothing better to do. That's just a far pawn, and it takes 2 tempi to take eat if you want to save your bishop. Your opponent need not take bigger of an advantage in the meantime, that you could defend from before taking the pawn.