While having a quick look at the sources, I learned about the quadtree: http://de.wikipedia.org/wiki/Quadtree.
agar.io is using this implementation: https://github.com/silflow/quadtree-javascript to optimize collision detection performance.
If you want a tree that does perform well and is similarly easy to understand, a dynamic AABB tree is much better.