Why doesn't Lichess' Stockfish suggest this bishop sacrifice? I arrived at the following position in an online game after the opponent left a queen hanging.

[FEN "r1b2r2/pp1p1ppk/2n1p3/6B1/2P5/5N2/PQ3PPP/R4RK1 w - - 0 16"]


In the game, I played 16. Bf6 with the idea that in case he accepts the sacrifice, my queen can come to an exposed king with mating ideas and possibility of exchanging the rook for the knight and I should probably be able to arrive with the rooks by lifting them sooner than his minor pieces are able to help significantly. If the opponent refuses, my bishop is still up with a better aim and I have possibilities of blasting the kingside with a major advantage.

I looked at the game with lichess' Stockfish to check if this was a blunder and the main lines lichess' Stockfish suggests to me are 16. Be3, 16. Qc2+, 16. Nd2, 16. c5 and 16. Qa3, the first line having an evaluation of +12.8. Bf6 is not suggested, but it has an evaluation of +18.0 after it is played, so it left me wondering why it doesn't suggest Bf6 in the first place. My guess is that maybe Stockfish does not consider sacrificial moves without a forced advantage if the player has a large lead, which seems reasonable, but this is only a guess.

Running an analysis in chess.com with the Komodo engine suggests Bf6 as the best move, with +11.6 evaluation, so it left me even more curious as to why Stockfish doesn't even consider it.
Good question. I let Stockfish 11 think on the position, and even by around depth 25-26 it didn't suggest Bf6. But like in your case, after making the move on the board, Stockfish suddenly realizes it is the best move. Although what's also odd is that after Bf6 gxf6 Qxf6, it takes Stockfish longer than at least depth 27 to realize it's a mate in 9 moves/18 ply (instead of some evaluation that's "only" over +20).

One possible explanation for all this is due to how engines prune. If an engine spends an equal amount of time examining every single move in its calculations, it will be very slow (there's an average of roughly 30 moves in a given position, so the complexity for searching everything is on the order of 30^depth). Therefore, they will spend more time thinking on moves that look more promising, and stop wasting as many resources on moves that look clearly worse.

In the position you posted, there are multiple moves that give at least a +12 evaluation. Meanwhile, Bf6 drops a bishop, and perhaps it is only multiple moves further that White's overwhelming compensation for it becomes apparent. There are already many +12 moves available from the starting position, so an engine could decide not to waste time going deep into the Bf6 branch, stopping at a point before it realizes how good it is.

But then when you actually play Bf6 on the board, there's nothing else for the engine to look at. It's "forced" to examine the Bf6 branch, and then it quickly realizes it's very good (although in Stockfish's case taking a while to realize it's a forced mate, likely due to this same pruning issue).

Note that all the above is just my own understanding of things, and there could be other factors at play. If I had to guess why Komodo suggested Bf6 to you but not Stockfish, it would be because Stockfish prunes more aggressively in order to be extremely fast in searching.