Valinomycin, like the antibiotic gramicidin, interferes with the ionic permeability of cell membranes. But unlike gramicidin, it acts as a carrier: imagine an u-shaped molecule on one side of the cell membrane that carries the ion in its pocket to the other side by flipping 180 degrees, a sort of n-shape, and has the opening at the other side of the membrane. But if you prefer, you may think of a donut with a K+ in the hole in the middle. Either way, this ion transport is messing up the oxidative phosphorylation in mitochondria and they're using the energy (generated by electron transport) to accumulate K+ instead of making energy in the form of ATP, aka the micro-organism will die because of lack of sufficient energy.

The structure of Valinomycin is a repeating cyclic molecule with four types of residues, being L-lactate, L-valine, D-hydroxyisovalerate and D-valine. It is a ionophore, with a hydrophilic centre an a hydrophobic surface, which is necessary to reside in the lipid bilayer.
The effectivity of a bit of valinomycin: with a concentration of 10-7 M, the conductance of the membrane to K+ increases more than 104-fold. However, this is also temperature dependent: at lower temperatures (lower than around 35° C.) the membrane is less flexible and the carrier will have more difficulties flipping from one side to the other. Second remark is, that this activity of valinomycin and the like affect prokaryotes as well as eukaryotes.

Related to the strucutre, is its preference for K+ comparing to Na+ which is a 1000-fold higher, although the complex is almost the same for both. This is because it is energetically more costly to bind Na+; or put in another way, water likes Na+ more than K+, so "K+ is allowed to leave" the water-solution.