Variable length subnet masking provides a mechanism for breaking up a network into smaller components. For example, 192.168.1.0/24 provides 1 network address and 254 host addresses. Using VLSM, I can create multiple networks out of the 192.168.1.0 network. For example, 192.168.1.0/25 represents 2 networks with 1 subnet bit: 192.168.1.0 and 192.168.1.128, each with 126 hosts.
Classless interdomain routing provides a mechanism for reprresenting lots of networks with only a single mask. For example if I use BGP to advertise 192.168.0.0/16, I am telling everyone who listens to by BGP announcement that I have the path to all the networks from 192.168.0.0 to 192.168.255.0.
As for how this plays out in IPv6, I'm not much of an IPv6 guy. I don't believe either of these schemes plays a part in IPv6 which has its own masking scheme.
Good luck,
SteveJ