Similar to my previous post on creating a multi-pass render from Maya 2011, this technique deals with creating a plain and simple ambient occlusion render in Maya 2012 (although the same technique works with Maya 2011 and Maya 2009). This technique is different in that you will only render out the Ambient Occlusion image, rather than all the separate layers of the image.
Or check out a video tutorial about setting up a script to automatically add Ambient Occlusion.
Or check out this updated post for adding Ambient Occlusion in Maya 2018 with Arnold.
Start by selecting all the objects in your scene that you want to appear in the ambient occlusion render. If you right click in an empty part of the scene, the fly out menu will let you choose Select All. Do this if you want all of your objects in your scene to render with ambient occlusion.
Make sure the Channel Box / Layer Editor tab is selected and choose the Render layers tab.
From the Layers drop down menu, select Create Layer from Selected.
This will create layer1. You can rename this layer to AmbientOcclusion if you want to keep your scene nice and tidy, otherwise select the layer, right click on the layer name and then choose Attributes.
Make sure the name of the layer is highlighted in the attributes panel and click on the Presets button. From the drop down menu, choose Occlusion.
This will set up your render layer to the ambient occlusion preset and attach an ambient occlusion surface shader to all of your objects. Note - all of the objects in your scene will have a black shader applied to them.
If you choose the mib_amb_occlusion tab when one of your objects is selected (or choose the surfaceShader from the HyperShade) you will be able to adjust the parameters of the ambient occlusion. The most important attributes are Samples, Spread and Max Distance.
Increasing the number of samples will make the render less grainy, but will make the render times longer.
Spread defines how wide of an angle is used to calculate the occlusion on a point. In practical use it is kind of similar to contrast. Low values of Spread will generally make a harsher transition from black to white, while higher values of Spread will generally make a more gradual transition.
Max Distance defines the maximum distance for which occlusion is calculated (Maya Documentation). This number will vary depending on the scale of your scene, but a Maximum Distance of 0 will sample the entire scene and is generally the preferred way to render Ambient Occlusion. If you choose a Maximum Distance of 0, the occlusion is calculated based on the entire scene.