Fitting strings to the headstock on my slide guitars might look difficult
but actually it's easier than stringing up a normal guitar.
Also you never get your fingers stabbed by loose ends.

This way of securing the strings goes back to gut instruments
and is still the best method.

After pinning the string at the tailpiece or bridge, feed the string backwards through the peg hole.
Rotate the peg until you can grab the end of the string. Now pull the string through until you still have enough left to go around the peg a few times.
Pull the string down under the peg, making an 'S' shape
Take the loose end and pass it behind the main string and then towards you. For the wound strings this is enough to lock the string in place when it is tightened.
For unwound strings, add this step.

After rotating the peg a bit, make a kink in the loose end so it locks the string in place.
Cut the loose string to about this length. The loose end should point away from the main part of the peg so that it doesn't end up under the string as it gets wound on.
As you wind the string on (a peg winder is very handy here) hold some tension on the main string with your other hand. This will help the string to wind smoothly onto the roller.
Thick wound strings only need the 'S' shape to lock them in. You don't want much string on the rollers of the heavier strings. For the bottom one once around is plenty.