The grid can be formed by setting up hub and nodes.
Hub: Hub is a computer or a server which will handle nodes. The client will be pointing to the hub URL using RemoteWebDriver class.
Typical example of the hub URL. http://<yourIP>:4444/wd/hub
The hub can be initiated by using below command.
java -jar selenium-standalone-<version>.jar -role hub
Once the hub is started sucessfully, you can navigate to http://<yourIP>:4444 and you should see the page with information about the grid server and other connected nodes.
Node: The node is a computer or a server which will host the set of browsers and connect with the hub to receive commands from the hub.
The node can be initiated with below command.
java -jar selenium-standalone-<version>.jar -role node -hub http://<yourIP>:4444/grid/register
Once node is initiated and connected to the grid, you can navigatae to http://<yourIP>:4444 on your browser and you should see the node information and browsers information. You can even specify the browser configuration to the node using -browser argument such as browserName, browserVersion, operating system, number of browser sessions, etc. You can connect as many nodes you want to the hub.
You can anytime navigate to http://<yourIP>:4444 on your browser to see number of nodes connected, browser configuration of each hosted browser and the grid information.
Based on the browser configuration you provide via DesiredCapabilites to the RemoteWebDriver class, the hub will forward session to that node.
Hope that helps!