From Wikipedia…
Both classes allow open or closed-cockpit designs (closed car must have a windscreen, a roof and doors on each side). New for 2011, all closed-cockpit cars must have fins on the rear bodywork to prevent them from rolling over in the air during crashes. Although a passenger seat is not used, cars have to be designed to carry two people. The empty area of the cockpit is therefore usually used to hold electronic devices and cooling equipment.
I think there’s pro’s and con’s for each, hence why you’ve got some open cars and some closed cars. Back in the days of the late 80’s and early 90’s, when the cars had mega horsepower and the Mulsanne straight was uninterrupted by Chicanes, cars used to top 250mph. These days they’ve got little more than half the horsepower, so I don’t think the full benefits of an enclosed canopy (one assumes better aerodynamics, but it might not be that simple) are quite so prevalent.
Closed canopies have the disadvantage of needing to be air conditioned to keep the driver cool (saps power, adds weight, decreases efficiency), they’re more complex when it comes to driver change time, and open canopies seem to work ok for F1 cars doing predominantly speeds up to 200mph still.
It’s an odd one though, as over the last decade or so, I’d say the open/closed canopy debate is far less important than the diesel Vs petrol debate. That said, Audi has just switched to an enclosed cockpit on its latest car, having stuck with open cockpits for the past 12 years.
IMO, I think the open cockpits make more sense, for most of the LMP races, where they typically race for only 4hrs or so with one driver change. Closed canopies have almost always been designed purely with the LeMans 24hr race win in mind I think.