Digital technology allows us to simulate very complex environments, from medical to engineering, and environment to weather. Flight simulation exists from longer before computers were widespread. At the beginning of my training, in California, I visited with a gentleman who had build a 737 simulator from real parts and electromechanical instruments. The huge thing occupied the better part of a two-car garage, had no cabin and no visuals, but it all worked perfectly through pulleys, levers, relays, contacts and lots of other devices including digital electronics. You could take off, get to cruising altitude, tune in an ILS and approach to decision height (the point were you must recognize the landing environment or go around for another try), all on instruments. Today we buy a software platform which we can operate through a mouse and a keyboard. Then we add more realistic controls, the first of which is usually a yoke and throttle. It rarely stops there as many have found out.
So how it all works is a matter of preference, really. Starting from one of the available platforms, the first expense, and building around it. X-plane 11 is a popular choice, but most people start with the venerable Microsoft Flight Simulator. Some professional environments use P3D from Lockheed Martin and more are available from other vendors. There is a bit of competition across all platforms. Add-ons, which enhance the original platform functionality are not always available for all of them, and some leverage the underlying software better than other. Add-ons cover a wide range of functions but primarily they deal with visuals. Approximately 50% of add-ons are sceneries, 20% aircraft models, and the rest utilities.