If a twin-engine aircraft has an engine problem and could fly somewhere for maintenance, is a single-engine ferry flight ever allowed? If so, do airlines or pilots ever decide to do this?
Civilian aircraft are not designed for this - but some military aircraft are. The Antonov-70 can easily take off with one engine inoperational (it has four in total), but it has a limited capability to take off with two engines out on the same side! For that, it has to be empty and can carry only minimum fuel.
This capability is the consequence of the demand of the Soviet Air Force for the An-70 to operate for 6 months with minimum maintenance. The Antonov design bureau, well aware of the limited capabilities of front-line troops in aircraft maintenance, designed this transporter with lots of redundancy.
Edit: With one engine inoperational, any twin-engined civilian aircraft would not be legal if it attempted a one-engine take-off. I would expect there is a way to do it, but it needs the agreement of the owner and some paperwork with the local authorities. If you can prove that this particular ferry flight is safe, I think you would be allowed to fly. But I am certain that without lengthy preparation and paperwork there is no way to legally take off on one engine only.
This is in contrast to military aviation where this kind of operation is planned for.
I can find no evidence of the FAA or any other authority ever issuing such a permit.
It has happened, though (without a permit). An SN-601 tried to take off from Portland with one engine. Unsuccessfully. Luckily no one was hurt.
There's also a lengthy thread about it on airliners.net, in which there are several undocumented, anecdotal stories about this being done successfully (and illegally), e.g. in a P-38 and either a Convair 240 or 600.
There are some good technical reasons why this is unlikely to be safe, or approved by any authority:
Asymmetric thrust will make the takeoff very difficult. In particular, until the airplane reaches VMC, it may not be possible to keep the airplane on the centerline with takeoff thrust on one engine.
Especially for piston airplanes, single-engine performance is often very poor. Hence the expression, "in the event of an engine failure, the other engine will get you to the scene of the crash."
All-engines-out operation in a multi-engine airliner is usually considered an extremely unlikely event, and as such, training is patchy and contingency procedures are very dire if they exist at all. Basically, if your one good engine dies, you'd be in mortal danger, much moreso than in a single-engine airplane, in which pilots are well trained for engine failures, since all-engines-out is a much more likely event.
Back to the notion of ferry permits, some guidance is given in 14 CFR §91.611, which lays out conditions for one-engine-inoperative ferry permits for 4-engine or 3-engine-turbine airplanes. It says nothing about twins though.
Large aircraft with huge power reserves probably could, assuming you can find a pilot willing to do it. A twin-engine fighter like an F-18 very likely can - the single-engine thrust-to-weight ratio is nearly double that of a 777, and if you light the afterburner it has more thrust on one engine than a 777 with both mills turning.
Smaller piston twins usually cannot - one engine is not enough.
The crash rate for light piston twins is (or used to be) much higher than that of piston singles. The reason: the asymmetric thrust made them much harder to control to the point where the occasional instructor said "if one engine goes, feather the other one too".
One notable example is the Cessna Skymaster - two engines, centerline thrust. notable enough that the FAA created a multi-engine license category just for it. Common accident mode in the Skymaster is feathering the wrong engine in-flight, and the number of takeoff failures with the back engine not running says it won't take off on just one either. Maybe if you removed the prop, no passengers, minimum fuel and a really long runway. Check your life insurance first.