Q:

How do pilots know that the switch/knob they just switched on/off actually did what it's supposed to do?

With the plethora of switches/knobs/buttons etc present in airplane cockpits, how can pilots be really sure that a button they just pushed (either to enable/disable some electronic system or move some non-visible part of the plane for example) has actually done its job correctly? 
Is there some sort of visual or auditory feedback?
Or do they have to always assume that these have worked, until they realize otherwise by observing the airplane or other related systems behavior?

A:

Depends on the system in question, but typically the following indications will serve as a means to verify that a system is functioning correctly.
Activation lights - some cockpit switches will illuminate when commanded by crew.  Granted this only can serve as an indication that the switch was engaged.
Indicator lights eg landing gear position lights, etc - remote switches on mechanical systems which are activated when said system are in a required positions or functioning.  The switch then can illuminate lights on an instrument panel.
Mechanical indicators eg flap position indicators - system provides either a mechanical or otherwise signal back to an indicator which mechanically moves in unison with with the system.
Information Displays - integrated flight decks and multifunction displays take inputs from similar remote mechanical, thermal, pressure and electrical inputs from aircraft systems and display either textual or graphic indications on displays.
Kinsethetic reactions - eg lowering flaps will cause the airplane  to decelerate and pitch up, landing gear actuation will cause sounds, vibrations, wind noises, etc.
Correct system function - eg autopilot mode engaged and the airplane is doing what the crew expected of the command.

A:

All flight guidance functions and their changes are shown on the Flight Mode Annunciator (FMA) and have corresponding switches on the Flight Control Unit (FCU).

The buttons on the FCU are usually lit when activated, and the mode is shown on the FMA.

Other systems, like pumps, generators etc. have pushbuttons that are lit when activated (or deactivated, depending on the system). Some have also a separate fault light on the button.

On Airbus aircraft, when doing a procedure according to ECAM, you get the first feedback from the ECAM screen when selecting a switch. The line on ECAM either disappears or changes color. The second feedback is on the button light. These two indications have different sources or sensors, so you can be relatively sure that the intended action is complete when getting the feefback, either one or both. In some systems both indications are required, others one is enough.
Non-critical systems like lights etc. do not necessarily have any feedback channel.

