Keser Shem Tov 46
"The Jewish people were not exiled until they denied G·d and the dynasty of David." [Yalkut Shimoni, I Samuel #106]
"The only difference between the world at the present and the world at the time of the Messiah is the subjugation to the [gentile] kingdoms." [Tractate Pesachim 68a]
The Baal Shem Tov taught:
The Talmud teaches, "Whoever has not suffered for forty days has received thereby his future reward. And what is considered suffering? Even if one puts his hand into his pocket to take out a golden coin and instead takes out one of lesser value." [Tractate Erkhin 16b]
However, since suffering is only in atonement for liability, how can such minor inconvenience constitute atonement?
The explanation is that since the righteous person lives with G·d, he believes in Divine providence and knows that G·d is guiding all events in his life down to the smallest minutiae, and that all his suffering is an expression of Divine justice - DINA, which is represented by the Divine Name of ADoNaI - on account of his sins.
Hence, as soon as the righteous person suffers however slightly, he immediately [searches his soul and] regrets [any misdoing], and becomes filled with anxiety and fear of G·d. He is thus immediately forgiven, since he believes [that his suffering is from G·d], and he repents and binds his mind to G·d.
Therefore, even when one is only slightly inconvenienced by having not taken out the coin he intended, since this only happened because of his sin, and he [is aware of this and] repents, this constitutes atonement.
This concept is referred to as "David" [made from the letters daleth, vav, daleth] :- for the Infinite One, Who is referred to as Ayin/Nothingness, is represented by the [first] daleth. "Nothingness" is then conveyed via the vav to the [second] dalet, which represents the nadir of nothingness, which is expressed by a belief that everything that happens is Divine providence from G·d.
However, when a person does not believe that everything that happens is Divine providence from G·d, but rather attributes things to his own actions, this is considered having denied G·d and the aforementioned concept of "David" for he is denying the justice [providence] of the Kingdom of G·d/ADoNaI.
But G·d's Kingdom is hidden and subservient to the kelipoth/shells that cover and conceal G·d's providence from mankind. (1)
In the future, though, with the coming of the Messiah, who will banish the spirit of impurity from the earth, G·d's providence will be revealed even in the minutest of events.
With this we can understand, "The Jewish people were not exiled until they denied G·d and the dynasty of David" and "The only difference between the world at present and the world at the time of the Messiah is the subjugation to the [gentile] kingdoms."
Understand this well (2) for everything that a person is able to comprehend about G·d is only regarding His Malkhut/Kingdom, but above that cannot be comprehended.
1) These "shells" are the "laws" of nature, the apparent cause-and-effect, and in this case, the statistical but "chance probabilities" that seem to govern whether one picks the gold coin or the copper one from one's pocket.
2) Until here is quoted from the Toldot Yaakov Yoseph, VaYishlach #8. The conclusion is that of the compiler of the Keser Shem Tov, and its relevance to the rest of the piece is not clear.