When the plastic ruler is rubbed with hair, it gains a charge due to friction (electrostatic charging). Water molecules are polar, meaning they have positive and negative sides. The charged ruler attracts the oppositely charged ends of the water molecules, causing the stream of water to bend toward the ruler.