You need a single hand free for both Material and Somatic Components to be met
The Rules on Spellcasting specify how Material and Somatic components work:
If a spell requires a somatic component, the caster must have free use of at least one hand to perform these gestures.
A character can use a component pouch or a spellcasting focus (found in “Equipment”) in place of the components specified for a spell....A spellcaster must have a hand free to access a spell's material components -- or to hold a spellcasting focus -- but it can be the same hand that he or she uses to perform somatic components.
Specific Questions
Using these guidelines, let's look at the questions presented:
Question 1
If a focus is merely worn, can a wizard still cast his spells?
No - as stated under Material Components, a spellcaster must have a hand free to access...to hold a spellcasting focus.... In order to cast with a Material Component, the focus can't simply be worn, it must be held.
To compare, classes that can use Holy Symbols (paladins and clerics) have the clear path to displaying their Holy Symbol as a Material Component on a worn item such as a shield (PHB, 151). This case gives a very clear example of needing to be holding the Focus.
To use the symbol in this way, the caster must hold it in hand, wear it visibly, or bear it on a shield.
Question 2
If it fits, can the wizard hold a component or focus in the same hand that performs somatic components?
Yes - and fitting really isn't a necessary requirement. The rule quoted above regarding Material Components explicitly states that it can be the same hand that he or she uses to perform the somatic components.
Reviewing other objects in hands
Let's take a look at the various options provided in the question and how they work in determining if and when you have a free hand.
Quarterstaff only
The wizard can release one hand from the weapon to be free for Somatic/Material components without any issues. See this question.
Dagger and Component Pouch
This is easier than you think it is! You don't need to 'hold' your component pouch/focus - but you do need to be able to touch it. In this case, you can wield your dagger in one hand and then have your free hand access your Material/Somatic Components during the casting.
Shield and Dagger
If you've somehow got a way as a wizard to cast spells with a shield in one hand and you've got a weapon in another you're going to come up against some obstacles.
Both hands occupied
Some classes resolve the Material component of Sword and Board (Cleric and Paladin), but if you don't then you need to free up a hand in order to cast a spell with either a Somatic component or both Somatic/Material components.
The Warcaster Feat(PHB, Chapter 5) will allow you perform Somatic components even if you have no free hands. A Cleric or Paladin with Warcaster can use their Holy Symbol on a shield for both Somatic and Material Components.
If you are an Arcane caster without Warcaster, then you will need to do the following in order to free a hand:
- Drop your weapon
- Use free hand for Material/Somatic components and cast spell
- Free Object interaction to pick weapon back up