Could our modern military beat a classical fantasy military that has access to; magic; classic races like elves, dwarfs, etc. ; and fantastical beasts?
If our military is written to win, then yes. Like most movies pitting humanity against races and in situations where they would absolutely lose in but made it through cause plot armor.
Like others have said, depends on what the magic is capable of, but I would give the advantage to the modern military. Could a dragon or griffon stand up to modern fighter jets who are able to fly faster and higher? Could a magical ground force withstand modern artillery and/or bombers? Could they produce shields or other countermeasures to protect themselves from those kinds of munitions? How would archers and mages fare against modern rifles that could engage them from hundreds of yards/meters away? Also, the greatest weapon in any war is information. The modern military (assuming the battlefield is somewhere on Earth) would have access to real-time info from satellites, radar, etc. Would the magical military have anything similar?
There was an anime called gate that addressed this specific event.
It was a very pro Japan are the good guys kind of almost propaganda anime, but long story short the main advantage that the non-magical earthlings had is computers and logistics and War experience from hundreds of years of wars without magic.
So it would be kind of like asking if a modern military could win against some 1400s era nights in armor who just happened to have missile launchers but not machine guns or tanks.
Fr though, "magic" is such a broad term nowadays that it's a hard question to answer. What kind of magic? I'm not super versed in fantasy but in Tolkein's world industry would inevitably beat fantasy
IIRC (if I recall Clausewitz), the context of war is important: what political/diplomatic goals are at stake? What is the terrain? What specific forces are available, what is the quality of their leadership, and how is their overall morale? etc. In the abstract, only questions like "what happens when a dragon uses a breath attack against a tank?" can be asked, and since this is imaginary, the answer is: whatever you want.
It all depends on what magic we're dealing with. If it's just casting a fireball we'll probably win, if someone summons an eldritch god that wipes out humanity... Probably not...
There would be an immediate ceasefire, so the military contractors running the modern military could buy access to magical tech and design new weapons to sell to third parties.
I think it would be like any alien invasion in media where we could effectively kill or destroy a small amount while being obliterated by a large amount. Half life comes to mind. I think it would depend on how many we would be dealing with.