Each computer or device on a network has a unique IP address. When one device needs to send data to another device, it finds the other device by the IP. An example is you loading a website. Your computer finds the website and it’s IP and asks the web server for the home page. The web server then sends the homepage to your IP address.
IP addresses work with subnet masks to make more possibilities for different IP’s in a network. If an IP is 22.214.171.124 and the subnet is 255.0.0.0 then the 1 identifies the network and the 2.3.4 identifies the device on the network. This subnet would be used in huge neworks with many computers. If a network has less than 255 computers an ideal subnet would be 255.255.255.0 where 1.2.3 would identify the network and .4 would would identify the device.