The information you want is freely available on the internet and a search of any search engine using the string "subnetting" or "supernetting" will yield enough hits to keep you reading for a while.
In a nutshell...a subnet mask is used to in sub/supernetting to differentiate between the network ID portion of an IP address and the host ID portion. It tells you how many bits are 'masked' off for use with the network or host ID portion of the IP address.
For instance in the following address (using CIDR notation):
192.168.0.0/22
you know that:
a) you have 22 bits for network ID's.
2^22 = 4194304 networks.
b) 32-22 = 10 bits for host ID's.
2^10 = 1024 which leaves you 1022 host ID's per network.
You know also that your subnet mask will be:
255.255.252.0 and that you will be incrementing your IP's by 4
Supernetting is the opposite of subnetting. With supernetting you're stealing bits back from the Network ID portion of the IP address to be used for more host IP addresses.
If none of the above makes sense or means anything to you, you really need to go read up on IP addressing....subnetting and supernetting.