tor to run continuously as soon as I am connected.
How does TAILS manage to start tor automatically?
It's installed as a system service, the same way as is defined here.
It's started automatically at boot by systemd, the system service manager.
Tails also has extensive configuration and tweaks for it to use Tor properly, simply installing Tor won't provide the same features but it will start automatically when the operating system starts.