Reasons can be offered why the movie is as close to perfect as it is. The Warner Bros. studio was at its height of talent, efficiency, and industry. Promising new leads Humphrey Bogart and Ingrid Bergman took the major roles, instead of reasonable but less interesting choices such as Robert Young or Irene Dunne. Casablanca was laced with stellar supporting actors like Claude Rains, Peter Lorre, and Sidney Greenstreet. 'A' list director Michael Curtiz was behind the camera, and casting the despised Nazis as villains certainly helped inspire the writers, who had to put together the script and story in short order.
But it is a miracle, nonetheless, that Casablanca scales the heights of greatness. The same elements existed for many other projects at Warner Bros. or other studios, but most of these films range from merely satisfactory to very good. Great films were made before, and would be again, but even The Maltese Falcon and To Have and Have Not (to mention similar contemporary efforts with the same lead and studio) are noticeably less exceptional, although they are excellent when not held to the exalted standards of Casablanca.
Bogart's pathos and mixed motivations are central to Casablanca's spectacular quality, of course. Still, the script has to be regarded as the key ingredient. Waves of famous quotes could be lifted from the script, which may stand the test of time as well as Shakespeare's plays.
Instead of repeating familiar quotes, however, it is equally worthwhile to study the less dramatic deliveries that reveal glimpses of character and setting. These included references to the bisexuality of Rains' corrupt police captain and his trading of sexual favors for exit visas. Looking for this is all part of the fun, more so than counting the number of times Bogart tells Bergman, "Here's looking at you, kid."
No film is completely perfect. Perhaps Paul Henreid is wound up too tight as uber-patriot Laszlo. Perhaps Bogart took a moment too long to shoot Conrad Veidt. Maybe the flashbacks set in Paris don't quite ring true.
Such trivial quibbles are demolished by the sheer force of moviemaking magic, the formula for which cannot be replicated. Even if you were on the set of Casablanca in 1942, and had complete access to the director, cinematographer, screenwriters, producers, and cast, it would still not be possible to fully understand the film's recipe, unless you were in a dozen places at once over the several weeks in which the film was made. Other films of equal or near equal greatness exist, but they are outstanding in altogether different ways.
Evaluating its story, Casablanca is an exercise in rebellion versus the Evil Empire. The Nazis and the Japanese were Hollywood's target of choice during this era, but such propaganda in this case has been justified by unfolding history. Concentration camps, as referred to in the script, are prisons where inmates might be tortured, and not a place where luckless minorities are herded together as a convenience for their extermination.
The strident heroism of Henreid aside, the other Resistance members are cagey fellows who believe they are in it for themselves, but in fact are increasingly motivated by patriotic impulses. Henreid leads a rousing rendition of the French national anthem, symbolic of the undercurrent of resistance to Nazi rule swelling up within the populace. Casablanca may be a multinational city of refugees and scoundrels, but they are united in contempt for their occupiers.