How do IP Cameras work?

How do IP cameras work? 

Put simply, Your camera(s) reside on your property and connect to your router (modem). Either via WiFi or cable. In this diagram I have specified WiFi. 

Then, within your router there is a webpage that allows you to control what goes in and out. Generally speaking, 2-way internet communication via your devices only occur when you are present an actively using the device. 
IP cameras are different. They allow you to communicate with the camera from the outside world, therefore they must allow data (video) to leave the camera, through the router to the device (Phone, PC, Tablet, MAC) no matter where you are in the world. 
In order to do this, a door must be opened inside the router to let this traffic through. This is called Port Forwarding. 

Many off the shelf cameras get around this method by communicating directly with their company and using it as an intermediary between your camera, router and phone. Such as DLink or Doorbell. These companies often charge you fees for this service. 
My method of installing these cameras is to bypass these 3rd parties and communicate with your device directly, allowing for no charges and in my opinion, better security.