Ignoring taxes, a share repurchase has exactly the same effect on the company and the shareholders' wealth as a cash dividend.
In either case, the company is disbursing cash to its shareholders; in the former, in exchange for shares which shareholders happen to be selling on the market at the time; in the latter, equally to all shareholders.
For those shareholders who do not happen to be selling their shares, a share repurchase by a company is equivalent to a shareholder's reinvestment of a cash dividend in additional shares of the same company. The only difference is the total number of shares left outstanding. Your shares after a share buyback represent ownership of a greater fraction of the company, since in effect the company is buying out other shareholders on your behalf.
Theoretically, a share buyback leaves the price of the stock unchanged, whereas a cash dividend tends to reduce the price of the stock by exactly the amount of the dividend, (notwithstanding underlying earnings.) This is because a share buyback concentrates your ownership in the company, but at the same time, the company as a whole is
devalued by the exact amount of cash disbursed to buy back shares.
Taxwise, a share buyback generally allows you to treat your share of the company's profits as capital gains---and quite possibly defer taxes on it as long as you own the stock. You usually have to pay taxes on dividends at the time they are paid. However, dividends are sometimes seen as instilling discipline in management, because it's a very public and obvious sign of distress for a company to cut its dividend, whereas a share repurchase plan can often be quietly withdrawn without drawing that much attention.
A third alternative to a dividend or a share repurchase is for the company to find profitable projects to reinvest its earnings in, and attempt to grow the company as a whole (in the hopes of even greater earnings in the future) rather than distribute current earnings back to shareholders. (A company may alse use its earnings to pay down or repurchase debt, as well.)
As to your second question, the SEC has certain rules that regulate the timing and price of share repurchases on the open market.