How did Joseph Stalin create a totalitarian state in the Soviet Union?
This is a question quite complicated and, I think, extremely complex!
We could think at Stalin simply as a ruthless and monstrous dictator that used violence and murder (in large...huge scale) mindlessly to mold and bend the state to his will and in doing so create a totalitarian state where he was the absolute ruler.
I think there is also an additional component to Stalin's approach that was absent, for example, in other dictators such as Mussolini or Hitler (focused on prosecuting specific components of the society): this is the ability to "periodically wage a kind of internal war against different portions of the Russian society to maintain it in a state of constant panic and insecurity"!
It seems a strange idea but periodically, in Soviet Russia under Stalin, we see this kind of internal war declared by the State (Stalin) against this or that section of the society: this war was waged with extreme violence and brutality (apparently without a reason or meaning) periodically decimating, peasants, thinkers, artists, politicians, priests, industrial workers, generals and army officers, members of the party, etc.
Basically Stalin every few months declared war against a social group (known generally as a Purge) and in doing so he decimated this group (the leaders in particular) maintaining a general feeling of terror and insecurity that allowed him to control the society constantly scared and in panic worried about who was going to be the next target.
This is something I observed reading in the literature about Stalin and certainly stroke me as an odd but decisive attitude of the dictator in maintaining his grip on the Soviet society.