For an arcane caster to cast a spell with a material (M) component, a spellcaster has three options. They can use either the the spell components, or a component pouch, or a spellcasting focus. To make spellcasting as easy as possible, it’s usually best to use either the pouch or the focus. An arcane focus can come in different forms including a crystal, orb, rod, staff or wand. Prices for these focuses can be found in the Player’s Handbook Chapter 5. Technically a staff that’s an arcane focus (cost 5 gp) is not the same as a quarterstaff (cost 2 sp). An arcane focus staff can be used as a quarterstaff, but a regular quarterstaff cannot be used as an arcane focus. So it’s a good idea to consider this while building your characters. Your DM might also allow you to use other items as an arcane focus too.
Arcane Casters
In D&D 5e, arcane casters include bards, sorcerers, warlocks, wizards, artificers, eldritch knights (Fighter subclass) and arcane tricksters (Rogue subclass). But for some (insane!) reason, the rules technically do not allow bards, artificers, arcane tricksters, and eldritch knights to use an arcane focus. Fortunately all of these classes can use a component pouch to cast their spells. Or alternatively, some of these casters can use other types of spellcasting foci. For example, a bard can use a musical instrument as a spellcasting focus, while an artificer can use thieves’ tools or artisan’s tools. Also good to note: an arcane focus or component pouch to cast spells requires a free hand. For this reason, certain characters might want to find an alternative spellcasting focus. For example, an eldritch knight wielding a sword and shield will need to drop their sword to cast a spell with S or M components. Fortunately, the knight can pick up the sword afterwards with their free Interact with an Object. There are also magic items that can act as a spellcasting focus that might allow your character to use both hands. For example, the Hat of Wizardry (common magic item) can act as a spellcasting focus for a wizard, or the Ruby of the War Mage (common magic item) lets you use a weapon as a spellcasting focus at the cost of an attunement slot. The War Caster feat also lets characters cast spells with a somatic (S) component, even if they have a weapon or shield in their hands.