Describe how a B-tree data structure works and why relational databases use them for indexing.