Professions (Smith, Carpenter, etc.); places/locations (Woods, Glenn, Stratford, etc); Colors (Black, Gray, etc); animals (Wolf, Deere, etc), lineage, as in who your parents or grandparents were (James' son ->Jameson) or in the royal tradition where the middle names and last names are previous maternal/fraternal members in the line; after famous or notable people (for instance, mine is from the apostle, who also happened to be called Levi); and some are just completely random based on what the first generation that chose the surname happened to like or whatever "stuck". Surnames really just developed from nicknames or descriptions attached to first names in order to distinguish between mutiple people with the same name.
It gets pretty confusing when you have 20 "Johns", or 12 "Michaels", or 8 "Ahmeds" in your village, so you need something to differentiate, and that's where surnames come from. For instance, if your name is "Sten", and people think you're ugly and start calling you "Sten the Ugly", your full name might eventually become (as remembered perhaps by later generations) "Sten Ugly", or "Sten DeUgly".