Electromagnetism Simulation
This can be modeled using blender physics. 
The animation was generated in Blender 2.76b from the attached .blend file. It uses the built-in physics. It shows attraction (blue-red), followed by repulsion (red-red). 




Create a scene with a plane and two cylinders above the plane. Add two empties. 
Parent an empty to each cylinder. The forces will be driven through the empties.
Select the plane and go to the physics tab. Enable rigid body physics for the the plane. Specify the plane will be animated. This will prevent movement of the plane, but give the cylinders something to slide on.





For each cylinder, on the physics tab, enable rigid body physics. This will let the cylinder collide with the plane and each other.





For each empty, enable forces in the physics tab. Set the forces to -100. You may need to adjust the forces depending on the spacing. The negative values indicate that the empties will attract each other. Positive values will cause the empties to push each other apart.





Run the animation to see the result.


A blender file illustrating this approach: 

This solution is similar to the approach described in this question: How to have rigid-bodies and charge fields interact?