A Last Will and Testament can be very complex. The longest and most complex one that I have drafted runs to about eighty pages. I've seen some in probate proceedings that run to about 120 pages, with additional exhibits of numerous pages containing legal descriptions for real property and serial numbers and account numbers for other assests.
How many resources will be expended to execute it? Is this process
self-funding?
The fiduciaries appointed to carry out with implementing a Last Will and Testament in a probate proceeding spend whatever they need to spend to carry it out, to the extent that funds are available in the estate. The assets of the estate pay for these costs of estate administration.
Say, if it prescribes that assets should be disseminated only upon a
condition, possibly many years in the future, can I be sure it will
happen exactly as described?
You can't. You're dead.
You nominate fiduciaries such as executives, personal representatives, administrators, guardians, conservators, trustees, custodians, and trust protectors to carry it out. They have fiduciary duties to faithfully carry out your instructions which interested persons, such as creditors and beneficiaries of the estate and trust protectors, can sue to enforce. In the case of charitable trusts, there is also a government official (in the United States, usually the state attorney general of the state in which the estate is administered) that has standing to enforce will and trust provisions for the benefit of a charity.
There are certain legal doctrines that exist to discourage you from exercising "dead hand" control for too long. One of this is a very complicated rule known as the "Rule Against Perpetuities" which differs from jurisdiction to jurisdiction. Another (in the U.S.) is a tax known as the Generation Skipping Transfer Tax.
There are also legal doctrines that allow interested persons to apply to a court to modify or reform the terms of a probated will or trust, doctrines such as the cy pres doctrine to deal with cases where transfers to entities or persons that no longer exist are present, doctrines that invalidate certain dead hand directions (e.g. related to race or to marriage) as a matter of public policy, statutes that invalidate certain kinds of real estate ownership with remote possibilities of reversion to a remote relative (e.g. fee tail), and doctrines that allow will and trust provisions to be reformed because it is impracticable to carry the out the terms even if it isn't strictly speaking impossible to do so.
For example, can I award my legacy to someone who solves a certain
equation (where the verification of this might be complex, and costly
in time and money)?
Subject to the doctrines set forth above, yes, this is possible.
The typical way to do this would be to establish a foundation to oversee this part of the legacy and to name someone such as the current holder of an endowed professorship, or the chair of a university department or scientific institute, as an arbitrator of the question of whether the condition was met (typically with instructions to pay for that service as an administrative cost or instructions that it be self-funded by the recipient of an endowment gift to an institution as a condition of receiving an endowment gift).
If an arbitrator was not appointed, a court would typically appoint an expert known as a "special master" to investigate the question (as the expense of the parties seeking to be paid and the estate) to determine if the condition was met in the event that this was disputed, or to ratify that the condition was met, in the event that this was not disputed. The "special master" would then investigate the matter and issue a report after receiving input from all parties and any independent investigation that was authorized by the order appointing the special master, and the report to the court would recommend a resolution. The parties could tell the court whether they disputed the special master's finding, and if so why, and the court would almost always adopt the special master's recommendation on the basis of that report. I have seen this process used in cases involving complex tax questions in probate court.
Another common way to do this would be to establish a donor advised fund in a "community foundation" which is a foundation shared by many donors with a common administrative staff and investment pool that administers foundation-like funds from particular donors according to the substantive terms of the fund.
There are examples of things similar to this (such as the Nobel Prize) being done. When I was in law school, there was a popular urban legend, I don't know if it was true or not, but it could have been true, that the dining hall in the law school (at the University of Michigan where I took my meals for my first year in law school) was endowed on the condition that steak be served every Friday. True or not, the steak was always there on Fridays.