Markov chains provide an easy way to generate plausible-sounding nonsense in a chatbot. They aren't particularly useful for serious purposes, but they can be used for an entertainment bot or to lighten the conversation with occasional silliness.
What is a Markov chain?
A Markov chain is a statistical process built on a state machine. In computational theory, a state machine is a physical or virtual machine that has some number of discrete states. It transitions from one state to another according to a set of rules. In a Markov process, the rules are based on probabilities. Given the machine's current state, there's a specified probability for one or more states that it will go there next. It could stay in the same state if that's appropriate.
When a chatbot uses this method, it will produce a piece of output to go with the state transition. This lets it construct sentences that are different every time but are more or less coherent. The starting state can be based on the user input, giving the response some relevance.
How does a Markov bot respond to users?
For instance, suppose the user asks "What is the secret of the universe?" The bot might pick up "universe" as a keyword to select its starting state. It could start by picking from one of several universe-related phrases and build up a reply by random association. It might be something like "Space is / a remarkably / delicious drink / made from / recycled cork boards." The response will usually look like nonsense, but once in a while its answers might be mistaken for profound philosophy.
A Markov chain bot could imitate a well-known person's style. It would take a large collection of sentences the celebrity has said and construct its states and probabilities based on them. Some bots of this kind might even adapt over time, "learning" new states and probabilities from new input. A bot could learn to imitate its users or work current headline topics into its output.
While this type of bot isn't a serious application of the technology, some people could take its output seriously. It should be used with caution.