I was recently trying to figure this out myself, and found this question. I didn't feel the accepted answer was quite complete, so here's my shot (no pun intended!):
The first thing to understand is that the light that reflects off any one point on a surface isn't one beam of light, but many, coming in at many different angles and reflected off at many different angles. Most of these beams will never hit the lens on the camera; however, some do, and will be focused onto a single point on the image-sensor (assuming that point is in focus).

Light from an in-focus point going through a lens
So what happens if we put an aperture behind (or in front of) the lens?

Aperture behind lens
Light from the point still hits the image-sensor, so it will still show up in the image. However, we now simply have less light from that point striking the sensor. This is why using a smaller aperture (or a smaller lens) requires longer exposure time; the sensor requires a longer amount of time to absorb the same amount of light.
So, if making the aperture smaller forces you to use longer exposure times, what's the point of having an aperture at all? Reducing the exposed light can sometimes be useful (for example, that is the purpose of an eyeball's pupil, which is exactly analogous to an aperture), but the primary reason for having an aperture in a camera actually has to do with points that are out of focus.

Out of focus point - too far away

Out of focus point - too close
Notice that, in both cases, the light beams all come from a single point, but they don't all hit the image-sensor at a single point. Rather, they are spread out in a circle. This is what causes out-of-focus points to appear blurred in a photo.
(This circle is sometimes called the Circle of Confusion. Incidentally, this also explains why out-of-focus points that are brighter than the surrounding points appear as circular discs)
So, what happens when we put an aperture behind (or in front of) the lens in this case?

Out of focus point with aperture
We see once again that less light hits the sensor, meaning we'll again need a longer exposure. However, something else has happened: the circle of light (from our point) striking the sensor has become smaller. This will cause the point to appear more in-focus in the final image! Hence, a smaller aperture will increase the depth-range at which objects appear in focus, ie. it increases the depth of field.
Thus, the larger the aperture (or lens), the less exposure time you'll need (due to there being more light), but the shallower your depth-of-field will be (due to the light from out-of-focus points striking a larger area). Inversely, the smaller your aperture (or lens), the larger your depth-of-field will be, but the more exposure time you'll need.
If we could get an infinitesimally-small aperture†, we could get everything in focus in one shot... but we'd need an extremely long exposure time, or an extremely sensitive sensor! This is essentially how a pinhole camera works.
† Well, the opening would still need to be larger than the light's wavelength, but that's a whole other topic...
I generated the above images using this awesome tool.