The easiest way to understand visitors is by comparing them to polymorphism. In polymorphic classes, you have a base class, which has virtual functions, and derived classes, which override these functions. You create objects of the derived classes, and store them as if they are objects of the base class (as pointers, mostly). When you call the virtual functions in the base class pointers, they will call the functions from the type that you originally created, which is the derived classes types.
Visitors are exactly the same, but are type-safe. However, visitors don't have a base type. You basically store all the "derived" types, i.e., the types that have the methods to be called, in a variant object (they're not really stored, they're really mutually exclusive, which is in the nature of variant). A variant is agnostic to the type of object it holds, just like the base class is agnostic to the derived type it holds. And just like calling a method in the base class pointer (mentioned above), will result in the overriding method to be called in the derived, the same applies to variants. When you "visit", the correct variant of the class will be used to call the function underneath.
Here's the catch: When you put multiple types in a variant, and you visit the methods in them, unlike the polymorphic type structures, methods don't have to share the same return type. So if a method in a class returns int, and the other method with the same name in another class returns a double, and you visit a variant that contains both, depending on which is instantiated in the variant, the correct return type will be returned.
Too much text, I know. Hope that helps.
template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>
is a deduction guide. – Simarouba