Any time something "magically lines up", it means that those molecules randomly float around until the right ones bump into each other.
Once they are in close enough proximity to bump into each other, intermolecular forces can come into play to get the "docking process" done.
For something like transcription, once they are "docked", think of it like a molecular machine - the process by which the polymerase moves down the strands is non-random.
There are also several ways to move things around in a more coordinated fashion. Often you have gradients of ion concentration, and molecules that want to move a certain direction within that gradient. You also have microtubules and molecular machinery that moves along them to ferry things to where they need to be. You can also just ensure a high concentration of some molecule in a specific place by building it there.
Float is the wrong word to use I think. Float implies gravity and water. At the scale of a cell gravity is not as important as intra-molecular forces like van-der-waals forces, and fluids do not behave like we think.
Once they are in close enough proximity to bump into each other, intermolecular forces can come into play to get the "docking process" done.
For something like transcription, once they are "docked", think of it like a molecular machine - the process by which the polymerase moves down the strands is non-random.
There are also several ways to move things around in a more coordinated fashion. Often you have gradients of ion concentration, and molecules that want to move a certain direction within that gradient. You also have microtubules and molecular machinery that moves along them to ferry things to where they need to be. You can also just ensure a high concentration of some molecule in a specific place by building it there.