There are multiple approaches how you can achieve a good placement snapping.
I personally don't know Fortnite enough to be able to tell you what approach they are using.
I would guess it's some kind of snapping points and a clever decission algorithm on which point to take.
Here's a list with some snapping techniques that I know of.
This list is not a complete one, there are countless ways how you can do snapping.
Using a 3d grid, in which you can place object is basically how Minecraft does it.
In essence you calculate to which cell the cursor points, then you add the object to the cell.
You can then test the properties of neighbor cells to determine the final shape, orientation, etc. of your new object.
Example game: Minecraft
- Local grid:
Instead of using a world grid like in minecraft, you can also use local grids.
Let's say the player should be able to place something freely on a terrain.
But when the player tries to place something on top of that other something, it should use a grid snapping relative to that first object.
This can be done by creating a new grid everytime something is not placed in a grid.
Now when you try to place an object on another object, you check whether that other object belongs to a grid, and if yes, place it in the grid. If no, create a local grid.
Example game: Space Engineers
Snapping points are locations on your meshes where other meshes can snap to.
If two points snap, the object to be placed gets moved, rotated, scaled or modified, such that both points are at the same place and the snapping criteria is fullfilled.
In case of stairs, the stair would have a snapping point at the top and the bottom of the stairs.
To determine whether two objects can snap, there are also multiple approaches, such as nearest point, look direction, something you come up with or even combinations of them.
Example game: Kerbal Space Program
- Snapping point classes:
As extension of the snapping points, you can also classify a snapping point, such as "Big object", "Ornament", etc and only snap to snapping points that match a filter criteria.
This can be usefull if certain objects are only allowed to snap to certain snapping points.
Instead of points, one could also snap to a line.
Just define lines along your object that allow snapping.
Then snapp to the nearest point on the nearest line.
Example game: Don't know...
Just use the mesh vertices as snapping points.
This is usually done in CAD, I haven't seen it in games.