But, how should I connect this motor to mains to get it working with minimal amount of smoke produced (if it works in the first place)
Nearly all variable frequency motors are three-phase motors. Unless you have three-phase power available, you can not test it by connecting to phase power. Before testing under power evaluate the motor as follows.
The first step in testing a salvaged motor should not be to connect it to power at all. First Use an ohmmeter to carefully check the resistance between each motor lead and every other lead. Record the resistance values. Also check the resistance between each lead and the motor core. For a three-phase motors, the resistance among the poser leads should be equal. Only the ground lead should show a low resistance to the motor frame.
Turn the shaft by hand to evaluate the condition of the bearings. Also note any resistance to turning that would indicate a permanent magnet rotor. A tendency for the rotor to stop in two or more fixed positions would indicate a permanent-magnet rotor. Attach an AC voltmeter between any two motor leads. If the the motor produces voltage when turned by hand, it is a permanent-magnet motor.
If the motor is a three-phase motor, you could test it using a Steinmetz connection. That is described in the answers to the following EESE questions and perhaps others.
3 phase motor running on single phase using steinmetz delta connection
Identifying direction of rotation for a three phase motor, without applying three-phase power