How can I tell when to sacrifice? What are factors to consider when and when not to sacrifice? For example, imagine in a game where your opponent puts his bishop in direct sight of yours and you're not sure whether to take it or not? Is it safe to assume that one of the factors would be if your bishop is bad, then it might be a good idea to sacrifice it especially if the opponent has a good bishop?
Sacrifices have the following goals:


exposing the king: for example after your opponent castled, sacrificing the bishop to take the pawn diagonally to the king.
cut the escape of the king: this one is hard to explain, but basically after the sacrifice, if the opponent recaptures, the king can no longer occupy this square. Note that this can also happen even if there was an enemy piece originally, and you sacrificed by capturing it, but under the scenario that the new piece there have different mobility (e.g usually a knight) so after a check this new piece can't block it as opposed to the old piece.
gaining (or making the opponent lose) tempos: sometimes you find combinations that allows you to make important moves in time, or make the opponent lose time that he doesn't have. One example is if the two players are about to promote, but you sacrifice a piece so that the king blocks his own pawn or moves into a square that will be attacked by the promoted Queen (so when you promote you deliver a check).
gain control of the center (or any other particular area): this usually happens by sacrificing pawns from the flanks to be recaptured with enemy pawns from the center.
weaken the pawn structure: in very closed positions, these kind of sacrifices are almost always played. I can't give examples since I have never done one and usually don't understand them without computer analysis.
removing of the defender (deflecting): when a piece is the only one stopping the inevitably, it is usually worth taking it down no matter if you lose material.
luring a piece to unwanted squares: luring the king into forks, screws, etc. Another example is when a enemy bishop is preventing your pawns to advance, making him move out of that diagonal is deadly.




Some quick examples from one of my games:

[FEN ""]
1. e4  e5 2. Bc4  d6 3. Nf3  h6 4. O-O  Nf6 5. Nc3  Be7 6. d4  exd4 7. Qxd4  O-O 8. Be3  Nc6 9. Qd3  Bg4 10. Bxh6  gxh6 11. e5  Nxe5 12. Nxe5  dxe5 13. Qg6+  Kh8 14. Qxh6+  Kg8 15. Ne4  Be6 16. Rfe1  Bxc4 17. Nxf6+  Bxf6 18. Re3  Bg5 19. Rg3  f6 20. Qg6+  Kh8 21. Rh3+ 1-0


(#1) - 10.Bxh6 might not be the best move from that position, but it is not a bad one either, there is a very dangerous pin by the white bishop that together with the Queen can do amazing things. The main idea is to expose the enemy king.

(#3 and #6) - 11.e5 if the Knight moved, I would have achieved #6 over the bishop, however he didn't and decided to take the pawn, I didn't care which way he take the pawn, my #3 is achieved since all I wanted to free the Queen diagonal.

(#6) - 15.Ne4 I attempted to remove the defender of the bishop, with the plan of capturing the bishop with this line 15.Ne4 Nxe4 16.Qg6+

(#3) - 16.Rfe1 is also interesting, some people would say it is not a direct sacrifice though, but it is deliberately not protecting a piece. The main idea is to don't waste any time and activate the rook ASAP, while still having a chance to protect the other piece if he decides to go for NxN first.