How to defeat a raid easily
Solution 1:
Raids are pretty hard, but here are some steps to be able to easily defeat them.
Before you start a raid, make sure you have all of these things:
Diamond armour, a bow, a stack of arrows (Or just one if you have infinity), a sword, and as much food as you want (I prefer a stack of cooked beef), and a shield.
-
Before you start a raid, make sure that you get most of your villagers inside their houses. You can easily do this by waiting until nighttime, and then block them in their houses while they are sleeping.
-
Choose any house that has no villager inside, and go inside it. Make sure to put these things inside: A bed, some ladders to the top of the house, and a double (or normal) chest.
-
Once you finish preparing, get the bad omen effect, and run into your chosen house.
-
Finish the raid by killing all enemies.
Here are some general tips, and how to defeat each enemy.
-
Only try to come outside if there are only a few enemies, and make sure to block with your shield if you have to!
-
The reason we put ladders to the roof, is to be able to shoot enemies from the top of the house.
-
You can use the 'door method' while you are inside. To do this, stay inside your house, open your door and place a block inside the house so nothing can get in. Then attack with your sword. You can do this with ravagers and vindicators, but not with pillagers evokers and pillagers.
Pillagers: Pillagers are the easiest to defeat. You can easily shoot them from your roof, or come outside and block with your shield if necessary while finishing them off with a sword.
Vindicators: Vindicators are pretty hard to defeat. Try shooting at them with your bow. These guys hold axes, and run fast while dealing lots of damage.
Witches: You probably have seen these before. They are fairly difficult to defeat, but easy if you shoot from afar with a bow.
Ravagers: Big monsters that are very difficult to defeat. Try to stay indoors while defeating them with a bow, or the door method.
Evokers: Probably one of the nastiest hostile mob, they attack by summoning big spikes on the ground in front of it, and creating vexes. Try to shoot from afar with a bow.
Vexes: These aren't spawned in the raid but are summoned by evokers. They are tiny little ghosts with iron sword that despawn fairly quickly and can pass through walls. Try to stay away in the open and hit them with your sword.
This is pretty much all you need to know about finishing the raid. If you have any questions about my answer, let me know in the comments.
Solution 2:
Depends if you want to defeat the raid once, for the thrill of it and the advancements, or if you want to defeat raids consistently, reaping significant rewards from the Hero of the Village status (and possibly from the raids themselves).
In the former case, Banana's answer is probably the best, balancing the amount of effort preparing for the raid (very little), and fighting it (quite a bit), for a reasonably low "total". You'll get the advancements, you'll possibly get some loot, and you'll enjoy discounts, providing you survive, which won't be that easy, especially with evokers releasing vexes on you.
If you want to get more serious about it though, and get actual good stream of profits from raids, including plenty of emeralds, totems of undying and 'hero of the village' status on demand, you should build a raid farm.
First off - the standard villages are hard to defend, so let's create a better one. Simply kidnap one of villagers (get him in a boat, then "row" over land, potentially using pistons to lift the boat or digging your path in dirt to cover any hills along the way), and transport him a good 200 blocks away from the village, preferably onto some open, mostly flat terrain, maybe not too far from a pillager outpost (but not so close as to be harassed by the patrols while building!).
Next, dig a decently deep hole - deep enough that accidental vexes won't find the villager (~15 blocks deep?), place a bed and a workstation right for the villager's occupation (any for unemployed) at the bottom, a light source so no zombies would spawn to kill your villager, drop him (in the boat) into the hole, release from the boat, then seal everything up. There, a village no raid can harm!
Now prepare means of fighting the raid: mark a 3-wide area slightly (1-2 blocks) to the side from the villager cell, then dig, or wall off (with 1-tall wall) a flat area that will flush all enemies towards the 3-wide hole - a rectangle of 16x19 space with corner sources raised (not to flood everything) is one option, but anything that will flush the enemies to the hole will do.
Example: ice where you want the initial water sources (using ice to generate them is probably the easiest approach) Result:
Next dig the 3-wide hole 28 blocks deep, and at the bottom prepare the kill chamber - extend the 3-wide hole into a 3-wide 3-tall corridor, place 3 hoppers connected to 3 double chests under the hole, slabs on top of the hoppers, solid blocks 1 block above the chests (leaving a slab-sized slit to attack legs of the pillagers), and independently a separate exit (a stairway?) leading to the surface a good distance from the farm, and basic comforts like a bed to set your spawn, extra chests to store surplus goods, and a lava disposal chute to burn tons of crossbows. The kill chamber should look like this:
(the red glass represents native rock surrounding your kill chamber, in which you dig it).
Finally, you need means to get rid of ravagers, which won't fit into the kill hole. We need to suspend a single lava block 2 blocks above the center in a "bowl" of intangible fire-proof blocks. The "cheaper" approach is to build the structure of signs - it's an eyesore but works:
(if you have trouble understanding what you see, it's topologically equivalent to this structure - except with wonky alignment of signs stacked on top of more signs.)
A much neater and easier approach is to use open fence gates made off giant Nether fungus stems (Warped or Crimson) - they are fireproof, and when open, intangible, and don't need supporting blocks.
(there is 1 block of gap between the bottom fence gate and the opening of the kill hole. In other words, a typical 2 blocks tall pillager will fall into the hole without burning its head. The huge ravager won't.)
After you're done, get bad omen, visit your 1-villager village, enter the kill chamber through your back entrance, then swing your sword at legs of everything that drops in until the raid has ended.
Credit for this simple raid farm concept goes to Mysticat, he also provides a block-by-block tutorial of a very similar build.
And if that is not enough for you - you may look into stacked raid farms; ones that manipulate what the game understands as villages, to turn a single bad omen into hundreds or raids happening simultaneously. The builds are way too massive and complex for a regular Q&A site answer, the requirements and precision of the build are very stringent, some components (like nametagged evokers) are difficult to obtain and contain, but the rewards are immense. The CSS Covenant's stacked raid farm is currently the state-of-the-art example of this class. While creating this build takes a lot of work, I'd argue ability of afk player to defeat a couple raids per second makes this "the easiest way to defeat a raid".