There is no need to do this for followers that can cast spells. These followers will automatically cast spells in combat. However, when given staffs, followers (even non-spell casting ones) can cast the spells of those staffs*, provided those staffs are charged with souls. In a way, you can manipulate a follower's inventory to have them cast spells.

They usually have sone sort of ranged spell and one for melee, similiar to bow and sword. Even Vicero from the Brotherhood has a variety of abilities including stealth. You are not able to command them to cast a specific spell though.