A message queue works by having a producer send messages to a queue. The queue stores these messages until a consumer is ready to receive them. When the consumer gets a message, it processes it and then sends an acknowledgment back to the queue. This acknowledgment tells the queue to remove the message. If the consumer does not acknowledge, the message stays in the queue and can be retried. This system helps separate the producer and consumer so they do not need to run at the same speed or time. Typical uses include distributing tasks, balancing loads, and handling work asynchronously.