Why did pull out and pull in the cmos fix my issue?

Sep 21, 2018
1
0
10
I built my pc 4 days ego, and last night when i switched on my pc motherboard light did on for few seconds then went off although cpu fan, case fan and led all worked but no display was shown. But the cpu fan and case fan n led kept running. So i checked all the wires, put the ram out and back again. Nothing worked. Then watching a video i tried to reset the cmos. So i just pulled the little circled coockie type thing out and then pulled back in. Then I started the pc and it worked giving a message on the display to reconfigure the bios.
All the pc parts were brand new.
Now what actually fixed the issue and is the issue fixed for ever or can happen again?
Please help