Its neurological memory.
Meaning that the motor coordination patterns are remembered by the brain, and even if take time off from training, those motor engrams still exist.
The longer you trained for, the more engrained the motor pattern into the brain. Neurons that fire together, wire together.
Even if you take time off from training and muscles atrophy, you still have some level of strength/coordination.
When you start training again, you are not relearning technique from zero. Your brain and muscles already know to how to coordinate.
Muscle begins to build back faster. Eventually you get back to where you were prior
“How long does it take to regain strength/muscle”
I dont know. No one can tell you this. Its contextually dependent on how long you didnt train for, and how much muscle you lost, and what lifts we are talking about. There is no one size fits all answer.
My recommendation is NEVER stop training, and negate this situation ever happening. You can maintain strength with just 2-3 hard sets to failure a week. Even with slight regression, thats far better than quitting training entirely.