Cat licking is partially to clean themselves (including of odors that might attract predators) but is also used as a cooling mechanism (they sweat little and so use evaporation of saliva as a cooling mechanism), socialization, and to help spread oils. Most hair in short haired cats passes through the digestive tract with no issue. Source The hair that is unable to pass through the cat will accumulate in the stomach and be coughed up as a hairball (generally every 1-2 weeks) source.
For more on a cat's digestive tract see here. Note also that the human digestive tract can manage all manner of weird things to and just allow it to 'pass through' and this is the 'default' behavior for many digestive tracts.