What happens if a professor is unable to get a PhD student for a part of their grant?
The exact rules may differ for each funder. However, typically, the PI writes a brief explanation why the PhD student could not be found. Then they either return a part of the budget to the funder and possibly adjust the project duration / scope accordingly, or as to redirect these funds to support the project in alternative way (e.g. hiring a postdoc instead of PhD).