Drivetrain, components of different brand Do all parts of the drive train have to be of the same brand? Can the chain be a different brand from the rest of the drive train? Cassette, crank, derailleurs?
The general answer is no. There are a number of standards that have emerged in the industry that mean different manufacturers products can be used in the same drivetrain.

Chain pitch and inner width are standardized so chains are generally interchangeable, but need to be of the correct external width to match the number of sprockets in the cassette of course.

Shimano and SRAM use the same freehub body design, so wheels, hubs and cassettes that use that standard all work together. Campagnolo uses a different freehub body design I believe.

Cranks have the match the number of speeds in the rear (chainring spacing has to match the width of the chain), provide the right chainline and fit in the bottom bracket (for which there is a confusing number of standards). New bikes are often outfitted with a non-Shimano or SRAM crank. FSA cranks are very common for instance.

Shifters and derailleurs do have to be from the same manufacturer and compatible with each other. Shimano mountain derailleurs and road shifters don't work with each other for example. Same for hydraulic brakes.

There's more interchangeability with mechanical rim brakes as the only thing that matters is the cable pull ratio. All linear pull (V-brake) calipers and levers work with each other for example

The back end of the drive train does not care what the front end is, as along as the crank is compatible and the rear derailleur can deal with the difference in chain ring sizes. A bike could be outfitted with a Shimano rear derailleur and shifter and SRAM front derailleur and shifter for example.