There is nothing wrong !
what do you think was wrong ?
The rail in factorio are not free form, there is set number of "pieces", this allow for easy blueprint, alignment, repetitions etc.
The draw back is that not every curve/transition is possible, for example if you want one train to switch to a parralel track, you have a minimum spacing. You can't do that with just 1 piece, it requires another arrangement of a few previous pieces. ( in current game, it requires at least 2 curves pieces)
This is what you can see on the video, the rail algorithm tries to reach the mouse cursor, but depending on the mouse movement sometimes the algorythm has to "rebuild" a significant portion of track, recombining different pieces that are 2X2 tiles or 4x6 or 2x8 ( made up numbers).
This is further looks weird because of the hotkey, Shift, when you are building real rail and not ghost is used to auto create loops. Shift is also the hotkey use to build ghost of other entities. So when you use Shift to create ghost of rail 2 behaviors are acting together in a seemgly weird fashion, which with a bit of experience, you can manage like Nilaus did there.
It is made easier to understand what is happening when you are pressing the hotkey at the same time as when you see the things happening.
Or if you use custom hotkeys, or press shift several times instead of doing the whole layout in 1 ghost ( which requires practice :d )