When a computer is to connect to a network, the computer has to have an address on the same sub-net as other devices that it is to work with. The address on the sub-net may either be configured manually, or the addresses may be assigned automatically to each device by a server, that can be integrated into your router or might be special computer that carries out extra validation that checks that the access to the network is valid. All devices on a particular network have to have their own unique address on that network.
Home routers include a mechanism called NAT (Network Address Translation). This mechanism allows multiple computers on the private network to share a single IP address on the Internet. This address follows the same rule, and is unique on its sub-net - the Internet.
For home routers, the address allocation is performed by a DHCP server, which is a small routing running in the router. Addresses are allocated for a fixed period of time (often around 24 hours). If a computer is still connected to the sub-net when some of the time has elapsed, then the computer will ask the DHCP server to renew its address. It will keep the same address, but the end time will be extended. If the computer is no longer on the sub-net, then the address will be freed for other devices to use when the time expires.
If the computer rejoins the network before the time expires, the router will allocate the same address. If the time has expired then the computer may be given a different addresses.
I hope this helps.