main 168.24.0.0/16

Hosts / ip Address / Subnet mask

500
100
50
20
5
2
2
2
please help me understand how

Explaining how the IP addresssing scheme and routing works in a single thread is really challenging.

In any event, what you are asking doesnt make much sense with regard to what you posted.

For example, you list 500 hosts. What do you want to know about this? I assume that you want to know how to divide 168.24.0.0/16 to accomodate 500 hosts per subnet?

If so, the network address and mask would be: 168.24.0.0/23. This gives you 510 hosts per subnet.

I think you need to do some reading and further research. Learning how to subnet takes time. I have a quick overview that you can refer to: CIDR and Subnetting

I also developed a simple online IP subnet calculator that you can reference. However, its not going to teach you how to do the process: IP Subnet Calculator. The calculator is not meant as tool for doing your homework.