The following is for entertainment purposes only. Sports betting is a very interesting academic topic, and I recommend you keep it an academic topic. You incur your own financial (and legal, in some jurisdictions) risks by acting upon anything I say :)
The process is more complicated than many people make it out to be. First of all, there are examples of sports books that are explicitly based upon the public's actions...basically they are matchmakers for those willing to offer bets and those willing to place them. Those generally aren't what we are talking about though. As for the others, one school of thoughts is for the houses to expertly determine the "true" odds, and set the line accordingly. As many in the comments pointed out, another school of thought is that the house can manipulate the line so as to receive balanced action on each side and guarantee profits (as was noted, the implied probabilities do not sum to 100%, so the difference is accounted for by the juice or vig). However, legitimate betting houses handle thousands and thousands of events every year, so they don't have to be overly concerned with guaranteeing a smaller profit if a larger profit can be had in expectation. As handled by sports books, this is not purely an accounting problem.
It's important at this point to make a couple distinctions. First I'll note the difference between opening lines and closing lines. Betting houses have to have some line before the market has acted on their lines, and these opening lines are considered less efficient than the closing lines just before an event starts. It's also important to note the difference between so-called "sharps" and "squares" in the betting world. Despite what they might think, most bettors are so-called "squares" that don't really have much if any discernible skill in picking a side on which to bet. "Sharps," on the other hand, are well-funded experts that know what they are doing. Whereas a square probably has a set limit that he will bet, independent of the odds, a sharp is very different. A sharp won't bet at all if he feels the odds are unfavorable, and he will bet a great deal if the lines do not update to reflect his actions. This is not pure irrational greed on the sharp's part; there is a statistical basis known as the Kelly criterion for determining how much to bet when one has an advantage.
So the existence of sharps makes it surprisingly non-trivial to simply set a 50/50 line and happily lock in profits. If the line is bad, sharps will hammer it over and over again. To maintain the 50/50 action, the house would have to adjust the line to the point where sharps no longer feel they have an advantage. There are lots of forces at work here...market forces, arbitrage between different books, and lots of information, but these are going to tend to make that closing line fairly close to the true odds, whether that was the original intention or not. Of course it's complicated since the house might have non-public information or might think they are smarter than the public. There's not really a simple answer, but just keep in mind that a) sports books want to maximize profit and b) there are smart people out there who bet more when the line is worse.
As for how they might determine the lines aside from actual betting (which might be important for instance in setting opening lines), there are numerous things they can do. First of all, they might look to other books and assume some variant of the efficient market hypothesis. However, they might also employ the same types of techniques that sharp bettors employ. In the 21st century, sports analytics is a growing field. There are numerous academic journals, conferences, and blogs dedicated solely to sports analytics. There's also a ton of data out there, beyond just which team won or lost. In Major League Baseball, for instance, data exists on just about anything one might want to track. Every play of every regular season game for roughly the last 60 years can be downloaded by anyone with an interest. There are also people that are quite knowledgeable at ascertaining relative skills of players by observing them play. I can't say what a specific book does, but the potential combination of analytics and scouting on behalf of the sports book is quite formidable.