In Arch Linux how can I find out which package to install that will contain file X?

Since pacman 5.0, there is built-in functionality for searching the database with the -F option. First update the database:

sudo pacman -Fy

Then you can see which package contains $filename with

pacman -F $filename

if you are searching for an exact file name or full path, or

pacman -Fx $expr

to have $expr interpreted as a regular expression.

Since you knew you were looking for an equivalent of apt-file, you could have looked it up in the Pacman Rosetta.

Alternatively, you can use pkgfile. Install it with pacman -S pkgfile, then run

sudo pkgfile -u

to update the database. To see what package contains $filename, run

pkgfile $filename

the google way:

site:www.archlinux.org/packages/ bin/filename

and in case it is in AUR instead of an official package:

site:aur.archlinux.org/packages/ bin/filename

From ArchWiki:

$ pacman -Qo df

This will yield the owning package of the program df (at the time of writing, this is coreutils).

-Qo only operates on installed packages and their programs.

You can to see more arguments in querying package databases.