To identify the network and the host portions of an IPv4 address, the subnet mask is compared to the IPv4 address bit by bit from left to right. What is the purpose of the host portion of an IPv4 address?
The host portion of an IP address is what distinguishes the host addresses on a network from each other.
The network portion tells a host if the IP address is on the same (directly to the host) or a different (to the configured gateway) network.
By the way, the answer to your question applies equally well to IPv6 also, but in IPv6, it is normally easier since the network and host portions will usually be 64 bits each (there are a few exceptions).