In my experience, there are two types of PhD students
(1) A professor offers a PhD studentship. Then, students apply directly and know their supervisor from the first day.
In this case, how a professor secure the funding for a PhD studentship?
(2) A department offers PhD studentships. After admission, students can choose their supervisors or the department will assign them to available professors.
In this case, how the capacity of each faculty member is determined to accept PhD students from available students of the department?
I know that the system varies from university to university, but I am curious to know the most common systems for each cases in North America and Eastern Europe.