79.1 "A player shall be permitted to stop or “bat” a puck in the
air with his open hand, or push it along the ice with his hand, and the
play shall not be stopped unless, in the opinion of the on-ice officials,
he has directed the puck to a teammate, or has allowed his team to
gain an advantage, and subsequently possession and control of the
puck is obtained by a player of the offending team, either directly or
deflected off any player or official."
http://www.nhl.com/nhl/en/v3/ext/rules/2018-2019-NHL-rulebook.pdf
See page 119, PDF page 130.
So here, it is not saying that it has to directly lead to the goal. It says it is a hand pass if "batted" to a teammate or if it "allowed his team to gain an advantage, and subsequently possession and control of the puck is obtained by a player of the offending team."
The hand pass happens several times a game. You are allowed to do it in your defensive zone, but not in the neutral zone or your offensive zone.
And based on that last sentence there, if it's deflected it's not enough because they go based off of possession and control of the puck.
The Sharks gained an advantage on the play because it was deflected to open teammates in front of the goal.