What were key factors that made the N1 the recipe for disaster it became for the USSR? Especially when the USSR was the Space King at the time?
Generically the program was underfunded, and the main issue was lack of full up testing of each stage.
With 30 engines, the interactions in the plumbing were very complex and caused imperfect fuel/oxidizer flow that affected the engines.
Engines that were sensitive to fuel/oxidizer flow issues with lots of them, lots of plumbing, huge volumes, needs lots of testing to get just right.
It is possible that quality control to achieve whatever solution was needed might have been beyond the Soviets. (Imagine rough welds inside pipes, and issues that might cause in this context. Then imagine the thousands of welds it likely needed).
With more time and money, they likely would have gotten much closer or even succeeded. Hard to know. But without the testing, failure was almost certainly guaranteed without great amounts of dumb luck.
To add to geoffc's excellent answer, another issue that might have been worked out with more testing was the KORD, a computer system for controlling the 30 different engines. Ideally, the KORD would handle the failure of one engine by stopping the engine on the opposite side of the rocket, maintaining symmetry of thrust. However, during the first and second test flights, the KORD ended up shutting down all the engines after detecting a failure of one engine. The second failure happened just a few seconds after liftoff; the rocket fell back to the pad and exploded, destroying the main pad and forcing the Soviets to spend a year and a half rebuilding.
More generally, a lot of the N1's problems stem from trying to eke an extra 20 tons out of it. The 7K-LOK/LK lunar spacecraft ended up substantially overweight, requiring the N1 to lift 95 metric tons instead of 75. This forced the designers to add 6 extra engines, which can't have helped things (although 24 engines was already pushing it). The N1 (and the Soviet program in general) also suffered from a lack of commitment and leadership, especially after Korolev's death in 1966.