That was a question I had as a beginner so I will do my best. If l write something you have figured out already, ignore that bit.
Raids are ways to get lots of XP, sometimes legendary Pokémon, sometimes shinies, and I think if you do them with a friend, they sometimes up your friendship a bit.
Every day when you spin a Photostop at a gym, you will get one daily raid pass. You only get one per day. You can get remote raid passes in the shop if you have enough Pokecoins, but you can only have three of those at a time.
With the daily raid pass, you go to a gym that has a raid going on. That is, you have to go there
. When you get there and tap it, it will give you a chance to battle. If you do so, the algorithm will choose a battle party of six Pokémon in your collection that it thinks will do well in that raid. You can make your own battle parties too and use those. You can invite friends to help you and sometimes your friends will invite you.
Then when you enter the arena, you have a specific amount of time to beat the Raid Boss. If you succeed, you get a bunch of XP, stardust, some items and a chance to catch the Pokémon you just beat. If you don't, you get some Stardust and some xp and can try again because Pokémon Go is a friendly game.
There are several levels of difficulty with the one star ones being the easiest and 5 star the hardest. One star and three star raids can be done on your own, but anything above that, you need friends to get it.
Hope that helps. If not, ask me more questions. 😃