I see a lot of people coming into 4s lobbies, saying that this is their first ever game in the format, and really, you only have the short pregame to explain an entire format to them, so to nullify those concerns, I'm creating a guide for the basics of 4s, and the roll each class plays
In 4v4, you can only have one of each class at any given time, and you can have either a heavy or medic, but not both. Most teams opt for a medic, since heavies can't heal beyond the occasional sandvich
You are generally going to be running a Scout, Soldier, Demoman, and Medic. However this may change since 4s allows for more offclassing than any other format around. Many teams opt for a pyro in lieu of their scout, and in rarer cases, the soldier or demo. The soldier is generally going to roam in 4s, with the demo generally sticking very close to the medic and leaving the scout to patrol the flank and make callouts, drop medics, etc. But in the case of a pyro being played, often the demo becomes a flank class, since the pyro can defend the med easily from both projectiles and scouts. This isn't to say the pyro can't flank in 4s, far from it. You can keep the demo as your main pocket, and have the pyro effectively taking over the scout's role, since with the powerjack his speed is very close to that of the scout, you can wrap around maps and get behind the medic.
Your role is to patrol the flank, you are the team's first warning of something bad coming their way. Spy circling around? You have eyes on him. Pyro or another scout trying to pull something sneaky? You're an early warning to your team, and potentially able to pick either of those classes in 1v1. As well as defending the flank, you are charged with making plays from behind enemy lines, such as dropping their med or sniper before they can put your team in a bad situation, or catching a stray demo or soldier when they aren't in a good spot to be defended by their team.
You are essentially playing the same role as the roamer in 6v6, you fight the point, bomb the medic, occasionally help the scout on the flank. It's ultimately up to your playstyle, since you are effective at helping defend your medic, or pushing into the other team to make opportunities for your combo or flank classes
I can provide much more comprehensive instructions on playing pyro in 4s, since it's my main. You are singularly most effective at protecting your medic, you can reflect rockets, stickies, pills. You are essentially a walking Short Circuit with flames while playing defensively, and on offence, you can do everything the scout can do, and can even drop medics faster with the flare gun when they aren't paying close attention. Even ubers aren't immune to you: Uber? Just puff them away until the only kill they might get is you. Kritz? On a demo, just keep those stickies the hell away from your team, and on a soldier, you can drop their med with a 270 dmg reflect without much difficulty. From personal experience you are an effective flank and defence, but the most success has been coordinating with your demoman so that he pockets while you flank, and vice versa, never leaving your med defenseless, but allowing both classes to play to their full capabilities.
Playing a defensive role like the class was designed for is perfect for 4s, you can keep other classes at a distance, for risk of serious damage output with your stickies, lay down traps to keep people out, or to let your combo escape, and your pipes can just about drop the scout, and make any other of the main classes seriously reconsider pushing into you without backup. To give some map examples, even with a coordinated push from the opposing team, on ashville, if you just keep the stickies flying at the point, with some support from your flank and roamer, you can stop the opposing team from taking much ground.
Heavy in 4s is used, but for very short periods of time. You generally sub off your med for a heavy in the last minute of the game, where you know uber isn't an option, so you go for a huge damage output and beefy tank. Just the surprise alone of a 300 health monstrosity with a gun pushing at your measly team of 3 classes that can fight effectively forces the other team to act quickly and wisely, or lose the round. Comboing this class with pressure from your demo and soldier, who are now both free to roam now that they don't have a medic, allows you to sneak in much more easily than if the pressure was only coming from a soldier, or a soldier and a scout
Engineer is only ran seriously on attack/defence maps for as long as you can hold a good sentry position for. Depending on the size of the map, you would sub out your soldier on a massive map like GPit, or on a map like Egypt or Dustbowl, your scout, since you don't need to cover as much ground easily. Your strategy is to get an early teleporter up to keep pressure on the point consistently, and get that level 3 gun in a spot that isn't easily spammed out, and can lay down a lot of hurt on the opposing team
Sniper is generally ran for a singular life to surprise their team and drop the med before he can get himself in a position where sniping is a less viable option. But I have seen teams run snipers full time when said sniper is a deadly quickscoper, getting a 4 killstreak singlehandedly with nothing more than good positioning and a quick hand. But if you're not that person, use your one life, or more if they don't start getting their med in better places, don't overcommit to the class and end up costing your team a valuable offensive class
A quick thing to get off the table before we start: Despite the small number of players, you can still get dropped very easily, and do not suddenly become a combat medic. With that aside here we have the class with the most pressure on himself the entire time. You are responsible for leading your team in most situations, pay attention to the callouts, find cover when being bombed, and follow the basic rule of medic: If you don't have a teammate between you and the thing that's trying to kill you, RUN! We can't all get on the ExTV Moments of Glory with a massive ubersaw killstreak, so just stay alive, and pay attention to the numbers on your team for when you're pushing
Just like the sniper, you're a class that is generally ran until the surprise wears off and they can anticipate you, but with the invis watch, most maps are set up with ammo packs that allow a spy with the invis watch to circle around the entire enemy team unnoticed, and drop the med without being noticed. An example of this is airfield: Going from your spawn entirely cloaked, go through your boiler, take the ammo pack, drop into your valley, take the ammo pack, go into the opposing team's elbow, take the ammo pack. You are now behind them, and you were not visible for any of this time. 4s spy is all about positioning and timing. Since the medic is often forced to back up and retreat, coordinate with your team and wait for the perfect opportunity to get that stab on the medic.
Thanks for reading my guide, I hope it helps new players to the format understand it a little bit more