Or rather what makes encounters difficult?
So suppose we decide to designs raids around a 20 man group. 2 tanks, 3 healers, and a mix of 15 melee and ranged.
Now suppose we want fights to last roughly 5 minutes (300 seconds).
Our DPS, with perfect rotations, can output 100 damage per second. Tanks can do 50 DPS.
Our healers can sustain 100 heals per second with perfectly optimized casting for 300 seconds before running out of mana. Tanks can mitigate or self heal another 50 HPS worth themselves.
So with perfect play in five minutes our DPS output 450,000 damage, tanks put out 30,000 damage, healers can heal 90,000 incoming damage and tanks can mitigate/heal another another 30,000 damage.
We then set the boss health to 480k and tune the raid to output 120k damage over five minutes and set an enrage mechanic to go off at the first second after five minutes that will kill everyone still alive.
So this is a very bare bones set up but it represents a zero margin of error style raid encounter. Every single raider must perform perfectly for five minutes without any human or computer error or even lag spikes.
In reality even the hardest fights are not this restrictive. By lowering the boss health we allow the DPS a margin of error. By lowering the unavoidable damage dealt to the raid we lower the healers margin of error. Tanks depend on how damage is dealt to them typically with a stacking mechanic that needs to be swapped off. If we add wiggle room to the amount of stacks a tank can have this allows for some error from the tanks as well.
We can also move some of the damage being done to avoidable mechanics. This increases the difficulty for players who have to now move or in some other way handle this issue but also allows for our group to show skill by lessening the difficulty of healing with greater awareness and reaction time.
We can also move some of the boss health onto adds, or have a period of time when the boss takes extra damage, or other such mechanics to lessen the amount of damage that needs to be dealt.
At the end of the design process we get a raid tuned in to a skill level that we find is acceptable for the challenge we wish to present.
We can then remove some mechanics entirely to make an easier difficultly, then again reduce out going damage and enemy health pools and extend the timings needed for other mechanics to make the raid easier still for an entry level raid.
This all sounds very simplistic and like common knowledge but I'm always surprised at the number of raiders who begin to attempt Mythic level content and blame a lack of gear or bad luck or some other such nonsense for poor performance or even for the lack of boss kills. I also hear players claiming that rankings don't matter. At the end of the tier it is true that a subset of the population over gears and goes on parse runs looking for top slots but there are ways to filter these people out and then see what people are bringing to the raid. The ranking is essentially a way of telling log analysts how well you perform compared to others who play your same spec.
Mythic fights are designed with a lower tolerance for error and sub optimal play and as such Mythic teams who value progression look for those players who make fewer errors and have more optimal performance.