In my field, everyone knows everyone else in a particular area of research. It's common for you to be applying for multiple jobs, some of which you might really, really want, and others that are backups. What happens if you get an offer from a backup job, and haven't heard from a prime job is that you ask the backup job for time to decide. Then you go to the prime job, and you say that you've had other offers, so you'd really appreciate it if you could get an update on their evaluation process. That can push prime job into making a offer, because if other people want you, you're more valuable (or reject you outright, so you aren't hanging on for a job you really want). There's a bit of a cascade effect as the top jobs go first, the top candidates make their refusals, and offers go to the next candidate on the list. This is all very normal, and people generally realize that given a choice, most people are going to take Caltech over small state school, or a general fellowship with a research budget over a position reducing someone else's data.
However, accepting a job and then cancelling afterwards would be seen as very bad form, because the employers will have already sent out rejection letters to the other candidates who will then have taken other jobs. So by doing that, you're forcing the employer to either take the bottom of the barrel candidates who have no other offers, or not hire someone that year.
Starting a job and quitting within weeks or months is pretty rare, in part because there's typically, there's a few months between accepting a job and starting work at a post-doc level, and up to a year at the faculty level. So putting in notice a few months into a post-doc or lectureship because you got a permanent faculty job would be considered totally understandable, but you'd generally have time to finish the year's teaching and wrap up your work before moving on.