When the fans are running, the hot air exits a slot at the rear, underneath the screen. It may be slightly impeded by opening the display over 90 degrees. Some heat is transferred to the bottom plate from the exiting air.
Closed clamshell covers the keyboard area and the rest of the top plate. If your MacBook Pro is an all-aluminum unibody type, this reduces the ability of the top plate to radiate and convect heat up and out, but has no bad impact on the fan-forced air. The fan speed is determined by measured temperature inside the MacBook.
My son the programmer put his external display up on 4 inch blocks, and kept the MacBook Pro open on the desk below. That way he could use both screens in Extended Desktop mode, and had another place to park extra windows.