Why don't simple machines change the amount of energy needed? Suppose I wanted to tighten a nut and I do so using two spanners of different arm lengths, say of $10 \text{ cm}$ and $20 \text{ cm}$. According to a an online source:

A spanner counts as a simple machine, and simple machines change the forces and torques required but not the total work done.

Why is it that the value of work taken to carry out the task is the same for both spanners despite it being easier use the longer one? How can this be shown mathematically?
 A: 
Why don't simple machines change the amount of energy needed?

The short answer is conservation of energy.
A simple machine does not supply any energy to perform work. It is not an energy source. It facilitates the transfer of energy in the form of work by reducing the needed force, which is generally referred to as the needed effort (or what you call making it easier), but requiring that force to act over a longer displacement (angular or linear).
In the case of the spanners (torque wrenches), since torque is the product of the applied force times the perpendicular distance from the nut (aka moment or lever arm), doubling the distance from 10 cm to 20 cm cuts the force (effort) in half. But the length of the circular path that the force needs to be applied is doubled, in order to perform the same amount of work. See the figures below.
Hope this helps.

A: Work Increases!
In fact, for almost all real machines, the total work increases when you use the machine!  That's because almost all machines introduce some frictional forces which waste some of the input energy.  For a simple spanner, that could include deforming the nut being tightened as well as air friction while rotating the spanner (although this is absent in vacuum and negligible for virtually all applications in atmosphere).  The spanner itself might also undergo small plastic deformation as well (at the point where it contacts the nut, or even in the handle, under large stresses).
Counterfactual Universe
Now, ignoring the pedantry above, let's think about a counterfactual universe in which simple machines could change the work performed.  There are two possibilities, and without loss of generality, we'll just consider the first one: work done decreases with leverage.  So, let's say that a 20 cm spanner requires less work than a 10 cm spanner under the same conditions (tightening/loosening a nut).
What this implies is that we can build machines that use less fuel simply by increasing their leverage!  So, for instance, a bicyclist would be able to travel much further simply by riding in a higher gear.  In fact, high gears would always be favored.  And the same is true for automobiles!  If the work reduction is proportional to the leverage, then we could probably double or triple the mileage of almost any powered vehicle simply by increasing the leverage used to move the vehicle!  The transmission of a car might end up being many times larger than the engine, simply because adding leverage is more cost-effective than adding power.
But what about going the opposite direction?  It means that shorter lever arms do more work.  It means that shorter people do proportionally more work than taller people just to move about every day!  Scaling down to insect sizes, it means that instead of carrying hundreds of times their weight, ants and spiders would get exhausted just walking around!  Of course, they might compensate for this by having extremely long legs, possibly cantilevered at the joints, just so they could walk!  But it would be incomprehensible to imagine grasshoppers jumping dozens of times their body height under these conditions!  They might burn up a whole day's worth of calories doing that!
Go even smaller still and imagine the flagellum of a bacterium.  This is one of the smallest machines we know of, and so, it would have the largest proportion of work expenditure due to its lever arms being literally molecular scale!  It might not even have sufficient metabolism to operate it.  Of course, cilia and flagella are rampant across the microbial world, and so we know that tiny levers/motors/machines work just as efficiently as large ones (or perhaps more efficiently, given the internal frictions mentioned above).
And if it turns out that longer levers require more work, then just reverse the argument above w.r.t. scale. ;)
A: "Easy", in the sense you seem to be using it, is subjective because it is synonymous with "convenient". For example, a 2m spanner is longer than a 20cm spanner. Would you still consider that easier than a 20cm spanner for a typical nut? It's even less torque than a 20cm spanner but way more time due to the distance required to travel to the point you have to walk in a circle. A needless distance. That's because "easy" is based on how well things match with your physical body's force and speed capabilities. Impedance matching. If you were very weak but very fast, a 2m spanner could very well be more convenient than a 30cm wrench. If you were much stronger and slower, it would be more difficult. If you were very strong, no wrench is most convenient.
If instead of convenient you thought of it as what it really is: less force, then that would half answer your question.
$$\text{Work} = \text{force} \times \text{distance} = Fd$$
Halving the force $F$ at the end of the lever arm by doubling the lever length $r$ doubles the arc length ($d = \theta r$) that must be traveled to turn the nut the same amount of angle $\theta$ so the work result remains unchanged.
You also see this if you look at the rotation form of the work equation:
$$\text{Work} = \text{angular displacement} \times \text{torque} = \theta \tau $$
Changing the lever arm length doesn't change the torque at the nut itself or the angle needed to travel to tighten the nut. All it does is redistribute the energy required to perform the work between force and speed to better match the force and speed output of your body.
A: The work to be done depends on the job to be done.  We often assume that a tool or simple machine does not cause a loss of energy, but a machine like a pulley system or an inclined plane may introduce friction.
