My question is multifaceted and I am very interested in the power struggles in NK.
Who were the other powerplayers in early NK history? Who were competing for power in NK politics.
Why the Kim dynasty?
How did the Kim dynasty cement itself? How did it go to party secretary for life, to adding in use of family succession?
I'll start by answering your first two questions by explaining how Kim Il-Sung (Kim Jong-Il's father and Kim Jong-un's grandfather) went from partisan fighter-leader to national dictator. This is an immensely complicated history, so for more information I would highly recommend Bradley K. Martin's excellent book, Under the Loving Care of the Fatherly Leader.
tl;dr -- when Kim Il-Sung came to power in 1948, he did so largely with Soviet backing and by playing to Soviet interests.
Soviet officials saw him as a "promising candidate for an important position in a new Korean regime." As they prepared their occupation of the Korean peninsula, the Soviets hoped to "make use of the fame he had achieved to make use of the fame he had achieved among Koreans during his guerrilla-fighting days."^1
But Kim very nearly didn't make it that far. Indeed, during his time as a partisan fighter (1930s) Kim narrowly missed being killed by his putative Chinese comrades. During the 1935 "Minsaengdan incident", Chinese Communists tortured and killed over a thousand Korean partisans and civilians under the assumption that they worked for the Japanese secret police, the kempetai, or at least supported the colonial government.^2 At the same time, Kim was also the subject of a substantive reward from the Japanese occupation authorities. The intense scrutiny under which he found himself was a good reason to "skip Dodge" and, indeed, Kim Il-Sung spent the first half of the 1940s in the relative safety of the USSR.
As a partisan leader/hero, Kim Il-Sung was a natural choice for a leadership position, perhaps Defence Minister. But the Soviets (who from 1945 to 1948 controlled all aspects of Korean internal politics) did not see him as necessarily leading the country. They preferred instead Cho Man-sik (who was called "Korean Gandhi" for his nonviolent resistance agianst the Japanese), hoping that he would be a willing puppet. This was not to be the case — Cho was a significant irritant for the Soviets and by January 1946 they had placed him into custody. He is widely believed to have been subsequently executed, in the second half of 1950.^3
Moscow would now choose between a number of important Communist/anti-Japanese fighters, with preference given to those fighters who had undergone Soviet training and indoctrination. Two candidates emerged in this period: Pak Hon-yong and Kim Il-Sung. Pak pushed for a pan-Korean government, which Moscow viewed with skepticism, "out of concern about dilution of Soviet control in/over the Korean peninsula."^4 Kim, on the other hand, argued fervently against immediate unification, and expressed a preference for continued Soviet tutelage. Kim Il-Sung's strong support for the USSR's stance inevitably tipped the balance in his favour: "on February 8 1946, with heavy backing from the Soviet authorities, he became chairman of the interim People's Committee. That made him the top Korean administrative leader in the North."^5 He was to maintain this position of supremacy until his death in 1994.
^1 ^2 ^3 ^4 ^5 Bradley K. Martin, Under the Loving Care of the Fatherly Leader: North Korea and the Kim Dynasty, (New York: Thomas Dunne Books, 2006)
Other sources consulted
Kim Jong-il was the party secretary. Kim Yong-il was either KJI's half brother who died in Germany 17 years ago or the Premier/head of government of North Korea from 2007 until 2010. The premier has an interesting history but it's mostly within the past 20 years.