Spatial partitioning structures are primarily used in the broad phase collision detection stage of physics engines to speed up spatial queries for objects in 2d/3d spaces. Most of the common use cases for BVH and octrees usually tie back to collision detection so it may be worth while for you to dig into the topic of physics engines if that's some thing that appeals to you. Here's a beginner friendly book that requires almost no prerequisite knowledge of math or physics if you're interested in making one. Game Physics Engine Development
One other use case that I can think of specifically for the octree is in ray traced voxel games where the entire world is made of a grid of cubes. Octrees are used to significantly reduce memory usage of voxel data and they're really fast to traverse for ray tracing.
There are two parts to physics engines: 1. detecting collision and 2. responding to it. Since you're interested in rectangles, let's discuss how we might write a basic physics engine for them.
Part 1: Detecting collision. Lets define collision as when two shapes "touch". So...write a function that accepts two rectangles and returns the boolean 'true' if they are overlapping and 'false' if they are not. That's it for part one, you've detected collision.
Part 2: Responding to it. Once you detect the rectangles are colliding, move them back to their previous positions before they collided. That's it for part two, you've responded to the collision.
Now...that was a very rudimentary example. It doesn't even deal with "sliding" the objects against each other, but it does illustrate the conceptual ideas.
If you're interested in this subject, then I'd recommend Ian Millington's book Game Physics Engine Development. It's aimed at 3D, but the same concepts apply to 2D.
Game Physics Engine Development is a pretty informative book if you want to understand how rigidbody physics and collisions work in games. You should be able to understand the mathematics if you understand vector mathematics(this is also explained, but not in as much detail as in a book dedicated to vector mathematics). The book also contains code samples, but these are written in C++.
I would recommend game physics engine development.
Start by reading at least one of the following books: Game Engine Physics Development Foundations Of Game Engine Mechanics