A horde that gives 5 EVs does so because each of the 5 pokemon gives 1 EV for their particular stat (eg: horde of Vanillite: 5 x 1 SpA = 5 SpA).

A horde that gives 10 EVs is because each of the 5 Pokemon give 2 EVs for their respective stat (eg: horde of Weepinbell: 5 x 2 Attack = 10)

Power items and PKRS apply to each pokemon you defeat individually. So if you have a Charmander that you're training in Special Attack infected with PKRS and holding a Power Lens and defeat a horde of Vanillite the formula would be:

5 x ((1 + 4) x 2 ) = 50

1 EV + 4 from the power item x 2 from PKRS x 5 Vanillish.

For Pokemon that give 2 EVs for a certain stat (eg: Weepinbell give 2 Attack) just swap that in:

5 x ((2 + 4) x 2 ) = 60

And like

Mieel said, you can continue fighting the same horde once you have maxed out that specific stat and just switch up the Power Item. So you would earn 40 EVs from that:

5 x ((0 + 4) x 2 ) = 40

(eg: after reaching 252 Speed from Wingull hordes, swap a Power Bracer onto your Gible to train it's Attack)

So the way I do it is infect Gible with PKRS, equip Power Anklet, turn Exp. Share on, fight 5 Wingull hordes (250 Speed EVs), swap the Anklet for Bracer, kill 6 more hordes (240 Attack EVs, would have picked up the remaining 2 Speed EVs on your 6th total horde battle). Now you can kill a 7th horde to max out Attack at 252, or finish it in Super Training, whatever floats your boat... So it will take 11 Battles doing this to reach 240 Attack and 252 Speed, or 12 battles to max them out, then you just have to pick up the remaining 6 EVs somewhere for your Gible to be fully trained (easily done in Super Training)

Hope this helped!