Slicing in General
An STL is a set of triangle surfaces. A Watertight STL - for slicing purposes - has surfaces that always create closed outlines if cut parallel to the XY plane.
A Slicer does exactly that: it creates plane-cuts at the indicated Z-heights, takes the plane-cut's outline(s), and decides a direction and order in which to follow the generated path. Then it uses this outline to generate the infill pattern, for example, as explained here.
The more paths there are and the smaller the triangles that are cut up, the more complex the solution process becomes and the longer it takes.
A slicer usually identifies areas that need support by calculating at which angle an STL Surface cuts a given plane cut. Under standard settings, this would be about less than 60° to the XY-plane with the normal of the surface having a negative Z-component - which means that a needle poking out of that surface points towards the bed.
The most simple form of support generation simply generates a grid pattern between such areas and the bed or next surface below. Tree support on the other tries to generate a support structure that bends around the object without intersecting and only relying on the support of itself.
Build Plate adhesion
A skirt and brim are just taking the outline of the build-plate intersection and surround that with outlines.
A Raft is generated like the simple support case, but taking the whole base of the object, adding a little edge around it and then generating the support grid there.