Switches and buttons work via the same principle, by mechanically connecting the power wire when you want the motor to run, and disconnecting it when you want it to stop. Essentially they switch between providing power or not, hence the name switch.
Imagine the simplest circuit possible: a battery connected to a light. In this example, power comes out of one side of the battery, goes into the light, then comes out and returns to the battery. As long as this loop is connected and the battery is charged, the light turns on. You can build this circuit with an LED, battery and some wire.
Now imagine if you were to remove the wire between the battery and the bulb. The light would turn off because power can no longer get to the bulb or from the bulb, depending on which wire you removed. This is exactly how a switch or button works. It mechanically disconnects the wire from the light.
The previous example of a switch is for a type known as a Single Pole Single Throw (abbreviated SPST). This means that one wire, the pole, can be connected or disconnected to only one other wire, the throw. The Push Button fits in a category of switches called Single Pole Double Throw (abbreviated SPDT). It is Single Pole because one wire (the pole) can be switched between two connections (the Throw)-in this case either to the ground of the battery when the button isn't pressed, or to the positive side of the motor when it is pressed. These types of switches usually have three terminals, the center being the Common (C) or Pole, and the other two designated as either Normally Open (NO) or Normally Closed (NC). NO designates the terminal that will not be connected to the battery when the button is left alone, i.e., this circuit is open, whereas NC designates the terminal that will be connected when the button is left alone, i.e., the part of the circuit that is closed.
Does this make sense? If you are confused, you may want to check out the video on how to use a multimeter to see how a switch works before you continue reading.
The toggle switch is in a category of switches called Double Pole Double Throw (DPDT). This means that there are two poles each of which has two throws. This enables you to simultaneously turn two independent circuits on or off at the same time. Now, you may be thinking, "can't you do that with two SPDT switches?" Yes, you can. It would work perfectly, except for the fact that you need more than one finger to turn on both switches, and as you build a more complex circuit, like a remote control, you will quickly run out of fingers if you use only single pole switches. So, to minimize finger strain, it is advantageous to use multiple pole switches to turn on or off all of the circuits that should turn on or off at the same time.
Anything! Once you can use a switch effectively and choose the right switch for the right job, you can make just about anything. As an example, computers use nothing more than millions and millions of switches to remember what your photos look like and what your music sounds like, even if you turn it off and unplug it. The computer has an amazing ability to code information in a language called binary, which is switch language for on or off. Everything on earth can be represented in this form, but the easiest form to understand is numbers. For example, the number 24 is a number written using standard decimal notation (also called base 10). If you convert this to binary (called base 2) you will see that it is equal to 11000.
24 is a number in base 10. The way base 10 works (and this may seem unnecessary to explain) is by indicating with the numbers 0-9 how many sets of 1's, 10's, 100's, 1000's, etc., there are. So for 24, there are no 1000's, no 1000's, two 10's, and four 1's. It could also be represented as having 2.4 10's, or 24 1's, but that is not allowed because in base 10, the numbers must be below 10, and you are only allowed to count in whole integers. The key thing that is often not understood is where the 1, 10, 100, and 1000 come from. You may think that each number ends in one more 0 than the previous number, and although that is correct, it is not how we arrive at those numbers. Each number comes from taking 10, and multiplying it by itself 0 times (not by 0 which would equal 0), then 1 time, then 2 times, then 3 times, and so on. You get the picture. This looks like this in mathematical notation:
100, 101, 102, 103, which is equal to 1, 10, 100, and 1000
This is read as ten to the 0th power, 10 to the 1st power, 10 to the 2nd power, and 10 to the 3rd power. If you replace the 10 with a 2, you get binary counting, or:
20, 21, 22, 23, 24, 25, which equals 1, 2, 4, 8, 16, and 32
Understanding this and applying the same theory of how to represent 24 in base 10, we can obtain 24 in base 2. There are no 32's in the number 24, so we will skip that. There is one 16 in 24, so we will make note of that and the remainder, 8. Next we check to see whether there are any 8's in the remainder, which is 8; there is one, which leaves us with a remainder of 0. Now even though there is no remainder left, we will continue checking the rest of the numbers. Are there any 4's in 0? No. Are there any 2's in 0? No. What about 1's? No. We are left with the understanding that there is one 16, one 8, zero 4's, zero 2's, and zero 1's, or 11000 in binary.
To answer this, it is essential to understand a few things. First, look at the number 11000. You should notice that there are only 1's and 0's. This is the key concept to understand. Try other numbers and you will see that any number you can come up with will be equal to a binary number with only 1's and 0's. In the electronic world, the number 1 is equivalent to "on," and 0 is equivalent to "off." Really. Go look at the power switch on the back of your computer, or the power switch of a vacuum cleaner. 1 means the device in running, 0 means it is not. Now that you believe this, think about what a number like 11000 could mean. How about "on, on, off, off, off?" Do you see how this applies to switches? If a computer wants to remember the number 24, it just turns the first two switches on and the next three off. That way, when the computer checks to see what number it was remembering, there are 5 switches in the pattern-"on, on, off, off, off"-that tell it the number was 24.
It may not seem like it, but your picture is actually a collection of millions of numbers in just a few categories. These categories include color, intensity, and position. If you are familiar with how light works, you will know that there are three primary colors of light (these operate differently from primary colors of paint): red, green, and blue. If you look really close at a screen or carefully put just one drop of water on a screen to act as a magnifying glass, you will see thousands of little red green and blue dots that make up the image you are looking at right now. The important feature of using three colors to make the full spectrum of colors you can see on the screen is blending. If you use red, green and blue light at full power, you will end up with the color white. (Again, it works differently than paint, which if mixed in these colors, would yield a brown-black hue.) Instead of showing you only white, red, blue, and green, the computer is able to turn each of the three lights on partially if needed. Thus, to make the color light yellow, it turns on the red and green lights to full power, and the blue to about 1/3 power. It does this by assigning each of the three colors a numerical value between 1 and 256 (or 1 and 100,000,000 in binary) that is proportional to the required brightness. So light yellow would be in the form [red][green][blue] represented as:
 in decimal, or in binary, 
The only other parameter is the location on the screen where this light yellow dot should appear, which is indicated by counting the number of dots or pixels from the top right corner of the screen you want to move your color to the right and down. If you want to move one inch right and one inch down, and there are 300 pixels per inch, you would move 300 pixels to the right, then 300 pixels down, and then apply your color. The full numerical command for this one yellow dot would like this:
     in decimal or
     in binary
That means for one yellow dot in a picture you would need 43 switches, and you need to do this for every dot on your screen at all times!