Candy canes have hooks because they represent the shepherd's crook and also Christmas.
Since the Shepherd uses a cane the candy cane represents that Shepherd of Christ and Christmas.
shepherds carried staffs or canes, and with the hook at the top of the stick and the candy canes have hooks because of that as well.
Also the hooks of candy canes make it easier to hang the candy canes on trees such as the Christmas Tree or Yule Tree.
You can also buy peppermint sticks that are like candy canes but they do not have the hooks.
But all regular candy canes for Christmas have hooks while the peppermint candy sticks do not.