I am not interested in the rabbit hole of decoding all the symbols in the last movie by Kubrick. Rather, I'm going to side with the most obvious and straightforward interpretation of this movie: It is a dream. The movie is very closely adapted from a short novel by the Austrian Jewish author Arthur Schnitzler, who was heavily influenced by Sigmund Freud and associated with Stefan Zweig. He even titled the novel "Dream Story" (Traumnovelle, 1926). Let's not outright dismiss the author's clue right in our faces, OK?
That the doctor is stirred by sexual jealousy due to his wife's confession of her fantasy over a stranger is not in dispute. Even when there are verbal warnings threatening his life, his mental images we see are always of his wife having sex with the stranger. He is enraged by her confession and tormented by jealousy, and goes out all night in search of some sort of "revenge" on her "infidelity."
It is not important to determine, specifically, whether each scene in his journey is either real or a dream. Freud has written that storytelling is a form of daydreaming, and fantasies are an integral part of our daily waking life. There is no such thing as an objective reality. The human reality is experienced through each person's own mind, which is distorted by our desires and biases, fears and shames, most of which subconscious.
If we explore the specific scenes in the doctor's dream, it becomes clear that they are a deeper examination of the nature of jealousy. What exactly is causing his rage? What is he frantically pursuing? His wife is obviously not planning to divorce him (even less likely in the 1920s Vienna) or have sex with another man for real, and he knows it. She has said nothing about being unsatisfied by her husband. In fact, her fantasy about the naval officer has nothing to do with her husband. Her fantasy is deliberately devoid of any implication of reality and is strictly an expression of her sexual desires, ie, a daydream, a collection of neurological activities caused by physiological/biochemical reactions in the body. It's something that everyone experiences from time to time, which cannot be regulated by any social forces and influences. I'm sure the doctor also fantasizes about sex all the time --- doesn't matter with whom.
Just as the wife's daydream has nothing to do with him, the husband's reaction has very little to do with her either. Rather, it is a trigger that releases a bunch of feelings inside himself. What is generally tossed under the label jealousy is more complicated than cliches. In this case, it is less about possessing his wife, body and mind, and more about his fear of his own inadequacy and undesirability. This fear is externalized in his dream, in which he becomes the object of the desire of his dead patient's daughter, he is ogled by the costume shop owner's teenage daughter, and later a prostitute at the masquerade orgy heroically sacrifices herself to save his life. These elements are very typical wish fulfilment. He is in urgent need of being proven desirable to counter the threat of inadequacy, and these women in his dream serve such a function.
What's curious is the frustration in his dream. Throughout the night, he watches other people have sex all around him, but he never gets any himself. He is either thwarted by circumstance or thrown out. When he propositions a (different) prostitute's friend in the morning, I could easily predict that he would be rejected yet again, but the excuse ("she is HIV positive!") still made me laugh out loud.
His sense of impotence lies not only in sexual frustration but also social frustration. He is constantly reminded that a doctor is a service provider, ie, servant, to his wealthy clients. He is not Jewish (curiously, Sydney Pollack is, and so is Kubrick), which removes an important element of the original story, but the class gap is illustrated throughout the movie. It's unclear whether it was intentional, but the author obviously linked social status and sexual status, which is extremely interesting and, perhaps, beyond the realm of psychoanalysis. Indeed, the concept of jealousy is not only associated with possession (of one's spouse or partner) but also with the feeling of envy, which is rooted in social and economical stratification. Sex is never only about sex. As social animals, people often confuse social status and sexual attractiveness.
In the first love-making scene, the wife looks into the mirror while being caressed by the husband. This suggests that, while love and sex involve two (or more) people, each person is stuck in his or her own world. Our desires and anxieties and fantasies are all about ourselves anyway, even under the illusion of converging minds.
Nicole Kidman gives a complex and accomplished performance in the movie. Unfortunately, the story is not about her or her point of view. It is sad that a story merely acknowledging women's sexual fantasies and desires in a morality-free way is still pretty unusual 70 years after the original publication (maybe not so much in Europe?). When Kubrick made the movie, I suppose, it was impossible to resist the temptation of casting the real-life, high-profile, and physically beautiful couple with questionable sexual tension as the on-screen husband and wife. The downside is that Tom Cruise is not entirely capable of conveying the sense of impotence and self-doubt required by the character. His performance nearly turned the movie into a thriller, occasionally on the verge of bursting into the running lawyer in The Firm.