Critical hits (in short crits) get distributed at random in TF2.
You have chances to increase your crits, as a Sniper you can make
headshots, and there are weapons that give more/less chance for a
crit. Also there is a Sandvich that gives an big crit boost, it
drops randomly.