to be honest, there is no "BEST" gamemode for xp. Its whichever one you are able to constantly do well on and earn kills and high killstreaks. People think that in TDM you don't get any xp and etc and on Demo and HQ you get so much more, no you don't.
Here is how I view it and how most people should.
All game modes take different time lengths and that should factor in to which one you want to play. Here is a random example of what I mean. I will use xp gained for an average player per each gamemode AND THE TIME IT TAKES PER MODE
TDM 5-10k, 5-6 mins per game
Domination 10-20K 10 mins per game
HQ-15-30K, 15 mins per game
Demolition-20-30k, 20 mins per game.
As you can see the math evens out roughly for each game mode when you factor in how long it takes per gamemode. If you are a very good player in any of these gamemodes then you can easily get double the xp regardless of being in a party or not. Another thing you have to remember about parties is that you are playing with people who probably know what to do and people who are going for plant/defuses and for kills THUS REDUCING YOUR ABILITY TO GET XP. Playing with parties is great and definitely better than playing alone but if you are constantly in the bottom three of your party, then you are losing out on free xp and are better of playing alone or playing with more people. Bottom line is that people have to realize that different game modes look like they give more xp but in reality if you factor in time and an average player, then it doesn't really make a difference. Also consider the fact that if you play s&d, demo or HQ, you are much more likely to encounter, and I mean much more likely, a full or close to full party which further decreases your chances of getting xp.
Tl

r, play the game mode which you do well in because that's where you get the most xp. People might say play this, play that etc but if you already rape in tdm and get 30+kills in a match, why would you even think about doing S&

?