I have an LCD monitor display and Oculus Rift attached to my PC. I have an Nvidia 820M dedicated GPU. How does the GPU know to which display device it has to render (or to send rendered information)? Are there any OpenGL/DirectX calls to bind display with the GPU?
The GPU doesn't, the programmer does.
The initialization of the graphics API will typically involve optional specification of which display device to use; not explicitly specifying this generally results in the default of whatever the OS thinks the "primary monitor" is.
OpenGL and D3D handle this decision differently. D3D has the concept of "adapters" modeled in to its API, and you can query the available number and figure out the the properties of each and then automatically decide or present a choice to the user.
OpenGL doesn't actually concern itself with formally specifying the creation of its context object for every OS; the OS itself handles that. You generally need to use the OS-level display-enumeration features (
NSScreen on OS X) to find the set of available displays and give them to the appropriate OS-level functions used to create the OpenGL context.
Usually this only matters if you're trying to use exclusive full-screen on a specific monitor, or render to a device that the system doesn't necessarily normally consider a "screen" (in that case getting the appropriate handle may involve the use of APIs specific to that hardware; this may be the case with the Rift, I'm not sure).
Generally if you're just doing windowed rendering, you don't need to worry about which monitor you are on.
If you're running on a Windows platform with the latest version of the Oculus SDK (0.6) and you're trying to figure out how to create a window and a rendering context to target the Rift, then this question is kind of meaningless. As of 0.6 the SDK now completely handles creation of the onscreen window to target the Rift display, regardless of whether the Rift is running in extended or direct mode.
Your responsibility as a developer is just to create a new D3D or OpenGL rendering context for creating the content that will be sent to the SDK. You can either create an onscreen window or an offscreen surface for this, and it doesn't really matter where you put the window, so it's simplest just to let the underlying system use a default location. The only caveat is that if you're running in extended mode, you don't want the window you create to end up on the Rift display, but since there's no way (in 0.6) to determine whether you're running in extended mode or which display belongs to the Rift, that's not possible, so just target the primary monitor on the assumption that it's probably not the Rift display.