system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How was it decided that most car engines go in the front of the vehicle?

And why do many luxury cars have engines in the back? What are the advantages or disadvantages when it comes to engine placement?
gpt
Packaging, cooling and handling. Only Porsche still uses rear engines in the 911. All other cars you may be thinking of are actually mid-engine. The difference is that in a 911, the engine is behind the rear axle. In a mid-engine car like the Cayman or Ferrari 458 the engine is ahead of the rear axle.

Mid-engine layouts handle quite well because there's little polar mass, so the car can rotate quickly. The downside is that it takes up a lot of space, so these cars are almost always 2-seaters.

Rear-engine layouts like the 911 have better packaging, but when the rear wheels lose grip, all that mass behind the rear axle may be difficult to control. You get something like a pendulum effect. Older 911s are notorious for this.

Front-engine layouts offer better packing, so more room for passengers, and while they have more polar mass than a mid-engine car, oversteer is easier to handle than in a rear-engine car. So it's a good compromise. In addition to that, you have plenty of airflow in the front to cool the engine with. This can be more tricky in rear- and mid-engine cars, which is why they sometimes have air intakes on the sides.