Save all render passes to EXR image?
Single EXRs or Multilayer?

First you have to decide what type of OpenEXR you want to render:


OpenEXR to get single files of your passes or channels/layers
EXR Multilayer to get a multi-channel file with all your passes or channels/layers included


This decision really depends on your further workfow. For e.g. Blender or Nuke it's much more useful to have one multi-channel EXR, but in Photoshop, After Effects or Fusion it's easier to use single EXRs.

In the context of the Layer Management the EXR Multilayer term is quite confusing. For this reason and also to consider the OpenEXR concept it should be named EXR Multichannel. 



Passes/AOV's

Then you have to decide which passes are key for compositing. In the view Layer tab->Passes section of the properties editor select the passes you need:



For 2.79 and earlier: In Scene Tab you can enable all standard passes of the render engine and create individual render layers.



You are ready to render if Multilayer EXR fits your needs. Blender automatically writes all enabled passes and layers as single channels to the EXR as expected.

If you choose OpenEXR, Blender only saves the beauty pass (final render) although other passes are selected. To save all your passes or channels/layers separately is only possible with the help of the image compositor. In this case you have to create a file output node and add new input slots in the properties of the node:



Still the same for Blender 2.8x:



The file output node makes it possible, whether OpenEXR or EXR Multilayer, but especially in the multilayer case, that you can unleash the full power of the format and pack your custom channels e.g. mattes or backgrounds like this:



Note: If a 'Z pass' is required, check out these answers: How can I get a Depth of field render pass?



Cycles light passes for reference



Further explanation in the manual: https://docs.blender.org/manual/en/latest/render/layers/passes.html



Tlousky's production script

To speed up this process you can also use Tlousky's production script. It automatically creates a file output node based on your enabled passes and your output directory:

 

Note: It's not updated since blender 2.69 that's why some passes are currently not supported.