Why are turbofan inlets circular- or oval-shaped instead of square-shaped?
Airliner jet intakes are round because the engines are round, and for subsonic flight that's all you need - it's easy and cheap to engineer, provides a clean airflow for the engine and unlike some other shape doesn't present unnecessary frontal area that will only cause drag. You've already identified ground clearance as the reason for a flattened shape on some installations.

Ah, you say, what about Concorde or the Tu144?



Source: http://www.hitechweb.genezis.eu

Notice that I specified 'subsonic'. Once one reaches supersonic speeds the requirements change. The intake is crucial in controlling airflow into the engine, reducing it's speed to a subsonic level so that the engine can operate efficiently. It's far easier to engineer the required flaps and baffles around a rectangular intake than to do the same with a circular one.

These are the different intake configurations for Concorde at (A) Take-off, (B) Supersonic cruise and (C) Reverse Thrust



(By Nubifer (Own work) [CC0], via Wikimedia Commons)

This is just as true of air intakes on supersonic military aircraft. You'll notice that almost all supersonic military aircraft use some variation of rectangular intakes for this reason.

As with all things aeronautical, there are exceptions. The English Electric Lightning,  Mig-21 and the SR-71 (and numerous others) use circular intakes with the geometry adjusted by a movable inlet cone.

You'll find a more detailed discussion of supersonic intakes in this answer




"MiG-21 RB23". Licensed under CC BY-SA 3.0 via Commons - https://commons.wikimedia.org/wiki/File:MiG-21_RB23.JPG#/media/File:MiG-21_RB23.JPG

"Lockheed SR-71 Blackbird" by Judson Brohmer/USAF - NASA Website Licensed under Public Domain via Commons - https://commons.wikimedia.org/wiki/File:Lockheed_SR-71_Blackbird.jpg#/media/File:Lockheed_SR-71_Blackbird.jpg