First you have to decide what you'll take with you, depending on what your team takes and what map you will be playing on. And then you will imagine some scenarios for what the other team could bring to the field; depending on that you create several "counter-loadouts".
But as there as to be a random factor as well, you can't just access everything during the match, so there can be a situation in which you are not able to counter the enemy team or vice versa by pure weaponry.
I guess there's the whole tactical thing to it, but sometimes I just want to pull out my shotgun on a map that I only expected to be using long range weapons on. Nothing pisses off a sniper more than sneaking close with a shotgun on an open map.