Macroeconomics is opposed to the conventional scheme of so-called Walrasian equilibrium where aggregate outcomes follow aggregating up of the behaviour of consumers and firms (according to various axioms, e.g. profit maximisation). The foundations for macroeconomics follow more from the logic required to abstract from human behaviour in a real world setting to the outcomes of the system as a whole. Critical to this process are an accurate representation of money, and recognition that key decisions are made in time and hence under conditions of uncertainty.
The rejection of Walrasian thinking is exemplified by the ‘fallacy of composition’, of which the most common example is the ‘paradox of thrift’. Under the conventional scheme, if individual saving is increased, the money goes instead to increased investment, which then increases national income. But under a macroeconomic view, higher individual saving means reduced consumption, and aggregate income is likely to fall, as is aggregate saving. So higher individual saving leads to lower aggregate saving.
Stephen Cecchetti (former Economic Adviser and Head of the Monetary and Economic Department at the BIS) has an apt analogy:
The third item on my list is representative agent models. For several decades, we have insisted that macroeconomic models be built on solid microeconomic foundations. And, even worse, that the microeconomic foundations be those for a representative agent. This created a lack of any real distinction between macroeconomics and microeconomics, beyond the questions the models were used to address. But the insistence on microeconomic foundations may have blinded us to the fact that the macroeconomic models are not up to the task of addressing the questions we really need to answer. An analogy may help illustrate what I have in mind. Let’s say that we are trying to measure tide height at the beach. We know that the sea is filled with fish, and so we exhaustively model fish behaviour, developing complex models of their movements and interactions. Finally, we have a model of the fish that we are able to simulate and compare to the data from monitoring the fish themselves. The model is great. And the model is useless. What we needed was a model of the moon! The behaviour of the fish is irrelevant for the question we are interested in: how high will the seawater go up the beach? I worry that by building microeconomic foundations we are focusing on the fish when we should be studying the moon. 
(Though the example he uses is a physical one, rather than one based on human interactions.)
Robert Skidelsky currently argues that the idea of microfoundations is the ‘worm’ standing in the way of progress in economics, and draws attention to a Keynes quote from 1903:
The unpopularity of the principle of organic unities shows very clearly how great is the danger of the assumption of unproved additive formulas. The fallacy, of which ignorance of organic unity is a particular instance, may perhaps be mathematically represented thus: suppose f(x) is the goodness of x and f(y) [is the goodness of y?]. It is then assumed that the goodness of x and y together is f(x) + f(y) when it is clearly f(x + y) and only in special cases will it be true that f(x + y) = f(x) + f(y). It is plain that it is never legitimate to assume this property in the case of any given function without proof.
J. M. Keynes ‘Ethics in Relation to Conduct’ (1903)
When Keynes turned to economics a few years later, his attention was first on money. His understanding and elaborating of the nature of money and associated processes of credit/debt creation was the foundation to all his subsequent theories and policy initiatives. He saw that the mainstream theory abstracted from money, and in so doing could not possibly reflect the monetary nature of economic interactions and as a result outcomes as a whole (employment, national income, prices etc.). Usually understood as Keynes’s rival, on this point Hayek said the same. In 1931, in his reply to Hayek’s review of his Treatise on Money, Keynes cited, with approval, this passage from Hayek’s Prices and Production:
[I]t means also that the task of monetary theory is a much wider one than is commonly assumed; that its task is nothing less than to cover a second time the whole field which is treated by pure theory under the assumption of Barter. (CW XIII, p. 254)
(Though Hayek ended up in a very different place to Keynes, in fact, pretty much where the mainstream theory started out; Keynes’s Cambridge university contemporary and rival Dennis Robertson did likewise, and Keynes had reservations about Knut Wicksell for similar reasons.)
Keynes’s theory of effective demand had credit/debt expanding to meet aggregate demand (though obviously not ruling out contractions in the supply of credit under certain conditions). The theory is also set in monetary terms, so that all processes are understood first as based on cash.
It is best to think about demand by sector, in particular households, firms/producers and the financial sector (not coincidentally, the National Accounts are built up from sectors). Key macro phenomena follow from abstractions of behaviour in each sector taken as a whole, of the collective behaviour of consumers, firms and investors. This is captured by what Keynes called psychological propensities: the marginal propensity to consume (mpc), the marginal efficiency of capital (mec) and liquidity preference (lp). Uncertainty comes in because the decisions are made in time, so that investment decisions are based on expectations of yield that cannot be known (and come under the sway of animal spirits), and the rate of interest. The latter is based on liquidity preference – which is based on investors’ assessment of future yields, which again are uncertain and cannot be known (unless the authorities seek to influence yields, see below) – set against the supply of ‘money’ (in the form of liquid assets). (Most fundamental to these decisions is the behaviour of those who seek to invest wealth: it is about saving not spending.) The production decision is also based on uncertainly.
There is equilibrium of sorts in each of these processes; under given expectations, each defines a unique outcome. So liquidity preference leads to the long-term rate of interest, which (adjusted for risk) leads alongside the mec to the level of investment. Aggregate demand then follows from the multiplier, which is based on the mpc. The allocation of demand to price and output/employment then depends on the conditions of supply, but of course Keynes considered that so long as there was spare capacity then output would be increased by higher demand.
At the level of the system as a whole the notion of equilibrium is not meaningless, but must be used carefully as concerning the stability of the system over time. Chick has explored this in most detail.
In my view the system has multiple equilibria and disequilibria. The overall equilibrium of the system is defined by aggregate demand, for Keynes fundamentally as a function of the rate of interest. Keynes’s theory of the cycle effectively described a disequilibrium process, triggered by animal spirits and undermined if expected yields on investment fell short of expectations (this also being a function of the rate of interest). But if expectations were met then the system might be stable, and hence in equilibrium over time (Keynes Betrayed, Chapter 7).
All of the analysis above follows from the operation of markets, and Keynes was not opposed to competition, “to implement not defeat the wisdom of Adam Smith”. But the system as a whole required management. On a domestic level this was aimed at setting the long-term rate of interest, under revised debt management and monetary processes. International arrangements had to be compatible with domestic goals, which meant capital control, but also ensuring sufficient money was created to meet the trading needs of all national economies (his clearing union).
Government spending does not feature in the core of his macroeconomic theory, but plainly Keynes saw an important role. Within his scheme, government did not ‘crowd out’ but was complementary to private activity, and should pay for itself no matter what size state society opted for. That does not close off questions of efficiency, though Keynes was uninterested.
For completeness, comparative advantage played no role in his scheme; full employment was achieved through internal demand rather than external trade.
But if nations can learn to provide themselves with full employment by their domestic policy … there need be no important economic forces calculated to set the interest of one country against that of its neighbours. There would still be room for the international division of labour and for international lending in appropriate conditions. But there would no longer be a pressing motive why one country need force its wares on another or repulse the offerings of its neighbour, not because this was necessary to enable it to pay for what it wished to purchase, but with the express object of upsetting the equilibrium of payments so as to develop a balance of trade in its own favour. International trade would cease to be what it is, namely, a desperate expedient to maintain employment at home by forcing sales on foreign markets and restricting purchases, which, if successful, will merely shift the problem of unemployment to the neighbour which is worsted in the struggle, but a willing and unimpeded exchange of goods and services in conditions of mutual advantage. (General Theory, pp. 382-3)
 See e.g. John King’s The Microfoundations Delusion (Edward Elgar, 2012) and associated debate, e.g.: http://socialdemocracy21stcentury.blogspot.co.uk/2013/04/king-on-post-keynesian-approaches-to.html. Keynes Betrayed, Geoff Tily (2010), Palgrave Macmillan.
 ‘John Maynard Keynes and the Development of National Accounts in Britain, 1895 to 1941’, Review of Income and Wealth, 55, 2, June 2009, 331-59.
 E.g. Macroeconomics After Keynes (1983), MIT Press; Chapter 2.