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 188.8.131.52/16 to accomodate 500 hosts per subnet?
If so, the network address and mask would be: 184.108.40.206/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.