An IPv4 address is 32 bits split into a network part and a host part. The subnet mask (or CIDR prefix like /24) decides where that split happens: the prefix counts how many leading bits identify the network, and the rest identify hosts inside it.
The first address in a block is the network address and the last is the broadcast address — neither can be assigned to a device, which is why a /24 has 256 total addresses but only 254 usable hosts. The wildcard mask is the inverse of the subnet mask and is often used in ACLs and routing rules.
Smaller prefixes (e.g. /16, /8) cover more hosts; larger prefixes (e.g. /30, /31) carve a network into tiny segments. A /31 is reserved for point-to-point links and a /32 identifies a single host.