There are two different situations:
1. You are going to run the software as root
In this case you should really trust the source code before using it. Either by auditing it, or by trusting the author and the delivery method.
If you are going to be recompiling the code, then I think the source files should be owned by root, so that an unprivileged user cannot modify them. And if the source tree is owned by root, then you will have to compile as root. If you trust the source code more than you trust your users, then that is the safer option.
2. You are going to run the software as a user
Ideally you should trust the source code before giving it to your users. But let's say that criterion is relaxed, and you don't fully trust the code.
Then it's not a good idea to compile or run the software as root.
Traditional installation, only partially as root
You can compile the software as any user, e.g. by running
./configure && make
But you might still need to run
sudo make install to make the compiled code visible to other users. In this case, you only need to audit the
Makefile before running it.
Build a package for root to install
Alternatively, on Debian and derivatives you can use something like
fakeroot equivs-build which will create a
dpkg which you can then install as root.
But be aware that packages may have post-install scripts which could do anything with root privileges. So this may also need auditing.
Safest: Install the software to a non-system folder
With this approach, root's involvement is minimised:
# Create a folder as root, and give one of your users control over it
sudo mkdir /opt/package_name
sudo chown user1:user1 /opt/package_name
# Now do compilation and installation as user1
# Finally, make the executable easily accessible to users
sudo ln -s /opt/package_name/executable /usr/local/bin/