How do admissions to UK PhD programs work?
How does the usual process look like?

Differently.

Are you applying for a 3+1 degree? Or a studentship? Or a normal PhD?
(Note: 3+1 (or 1+3) degrees are a combination of a 1-year Master's and a 3-year PhD. Their first year is equivalent to a Master's, and upon satisfactory performance at the end of your first year, you are allowed into the PhD programme. Sometimes the first year is done at one university, and the remaining three years at another university. Example 1 Example2)

Does the application require a research proposal? And/or a writing/work sample? And/or a personal statement?

Do you have your own funding? If not, what type of funding are you applying for? If the funding applications are separate, do they require their own documents?

Etc.

Would I first contact a professor I would like to work with and then apply to the program?

Unless it is a 3+1 course, then normally yes. You would have to find a supervisor willing to supervise you, and to help you properly form your research proposal.
If you are applying for a studentship, then it is likely that most, if not all, the information needed to write the research proposal is already available.

In 3+1 courses, the applications tend to be much more general. They often do not require research proposal, but rather personal and/or research statements. Also, you typically are not required to get in touch with any of the supervising staff, because the topic of your PhD is decided toward the end of your first year. 

And how specific should my research idea be?

Research proposals are very specific. It is rare for students to deviate too much from the core of their research proposals during their PhDs.

To get a broad idea of how specific your research proposal should be, I can tell you that your research proposal would need to have introduction, background, aims, methodology, possibly a strategy/schedule, possibly a section about the importance of the research, etc.

But, many people (and most, if not all, successful candidates) get help from their potential supervisors with forming and writing their research proposals.

How do people do this?

I cannot say how other people did it, but the way I wrote my research proposal was I started with a more general idea, then I read a lot about it, which helped me to reduce it to a somewhat specific idea and to find a couple of possibly suitable approaches to achieve this idea. Then I got in touch with a potential supervisor who pointed me to a few recent papers, which further narrowed down my idea to something that looked like a proper PhD project. He then helped me write my research proposal by providing me with tips and very useful feedback.