I apologize in advance as this question might seem very introductory/simple, or it might even sound a bit vague. I am very new to design in any field other than UI/UX design, so I'm definitely very far behind, but I'll home in on exactly what I mean and hopefully this question can be answered effectively.
Explaining the title, I think the most common example that I tend to use is Legos, as with every sorta kit or design, there's always a way to attach items (say, gears) to mounting points through joints (if you want rotational motion to be translated, you could use a plus axle; if you want something to swing freely, you use a beige pin; if you want something to be more or less fixed, you use a black pin, etc). In practical situations that aren't Lego though, this doesn't seem to be a thing. I don't see a lot of plus axles used in machinery diagrams and similar things, and I'm assuming this is probably because it's unoptimal for force distribution or some other impractical reason.
So my main question basically is as follows:
What is the standard way to design machinery that involves motion, either rotational or positional? I've heard of and seen a lot of mechanical designs that allow you to convert motion, such as maybe a rack and pinion mechanism or a four-bar linkage mechanism, but how are any of these anchored to anything else? Say I wanted to pass an axle through a block like this (forgive my terrible drawing) and rotate it on one side:
This already opens up a large amount of questions, like how do I pin the axle in place, how do I deal w/ friction (as I assume that's probably an issue), and a bunch of others. What should the design of this axle be? Should it be keyed so that I can rotate it with decent force? I assume it can't be perfectly round because it would then slip. How would I, say, place a gear on the axle (in Legos, you could just slide it on)?
I was sorta hoping for a general design principle or something that would allow me to create a design that is effective and practical. If any clarification is needed I am happy to provide in comments or edits or otherwise.
Again, apologies for the question being a bit vague or really simple but I've been wanting to start designing machines that use this similar mechanism for the purpose of 3d printing, and I've wanted to start in a CAD software I know, like Fusion 360 or Solidworks, but I'm stuck trying to figure out what I should even be designing. Help is greatly appreciated. Thanks!
EDIT: Looking into bearings, I'm seeing how parts can be coupled together, but this still doesn't seem to cover a lot of other mounting methods, this still somewhat is a problem