Some bots use passive listening. Voice assistants regularly monitor your speech for trigger words. This allows them to react to the user's query once the trigger word is said.
Voice recognition kicks in. Voice recognition is possible due to voice recognition software (AI+deep learning). When the bot is getting activated, it understands what it's listening to.
Followed by natural language processing. This includes context, user intent, slang, accents, and other loosely formal aspects of the human language.
Information retrieval. Now, the voice assistant needs to retrieve the information related to the question. This could be done by calling on APIs and accessing a knowledge base. This acts as a central repository to draw information from.
Information is then output. The machine uses NLP to recognize what it just heard. It takes the information from different sources. The end product is an answer that hopefully satisfies the user's request.