It's explained in Perfect Memento in Strict Sense (the official guide to Touhou from games 6-9) that humans can become youkai after years of studying magic and learning the spells that enable one to be able to not need sleep and to not be able to eat. It turns the magician into a youkai and grants pseudo-immortality, which means that they can live forever (or at least for centuries) but are not truly immortal (like Kaguya and Mokou are).