Madison on the Federalist Papers:
The story of how the Federalist Papers came to be written is well-known, but I thought readers might like to read Madison's own account, which is found in the Detached Memorandum:
The papers, so entitled, were written in the latter part of 1787, & the early part of 1788 by Alexander Hamilton, John Jay and James Madison. The original and immediate object of them was to promote the ratification of the new Constitution by the State of N. York where it was powerfully opposed, and where its success was deemed of critical importance.

According to the original plan & in the early numbers, the papers went out as from a Citizen of N. Y. It being found however that they were republished in other States and were making a diffusive impression in favor of the Constitution, that limited character was laid aside.

The undertaking was proposed by A. Hamilton to J. M. with a request to join him & Mr. Jay in carrying it into effect. William Duers was also included in the original plan & wrote two or perhaps more papers, which tho' intelligent & sprightly, were not continued; nor did they make a part of the printed Collection.

I suggested to Mr. H. that [name scratched out but seems to be "King," possibly Rufus King] might be a proper auxiliary, as he had been a member of the Convention, and well understood the subject to be discussed. He spoke respectfully of Mr [blank] talents but did not consider them as altogether of the sort required for the task in view.

The papers were first published in the Newspapers of the City. They were written most of them in great haste, and without any special allotment of the different parts of the subject to the several writers, J. M. being at the time a member of the then Congress, and A. H. being also a member, and occupied moreover in his profession at the bar, it was understood that each was to write as their respective situations permitted, preserving as much as possible an order & connection in the papers successively published.

This will account for [any] deficiency in that respect, and also for an occasional repetition of the views taken of particular branches of the subject. The haste with which many of the papers were penned, in order to get thro the subject whilst the Constitution was before the public, and to comply with the arrangement by which the printer was to keep his newspaper open for four numbers every week, was such that the performance must have borne a very different aspect without the aid of historical and other notes which had been used in the Convention and without the familiarity with the whole subject produced by the discussions there. It frequently happened that whilst the printer was putting into type the parts of a number, the following parts were under the pen, & to be furnished in time for the press.

In the beginning it was the practice of the writers, of A. H. & J. M. particularly to communicate each to the other, their respective papers before they were sent to the press. This was rendered so inconvenient, by the shortness of the time allowed, that it was dispensed with. Another reason was, that it was found most agreeable to each, not to give a positive sanction to all the doctrines and sentiments of the other; there being a known difference in the general complexion of their political theories.
Madison then addresses the dispute over exactly who wrote which paper.