Like other alchemists of the time, Brand searched for the "philosopher's stone", a substance which supposedly transformed base metals (like lead) into gold. By the time his first wife died he had exhausted her money on this pursuit. He then married his second wife Margaretha, a wealthy widow whose financial resources allowed him to continue the search. 
Like many before him, he was interested in urine and tried combining it with various other materials, in hundreds of combinations. He had seen for instance a recipe in a book 400 Auserlensene Chemische Process, by F. T. Kessler of Strasbourg, published in 1630, for using alum, saltpetre (potassium nitrate) and concentrated urine to turn base metals into silver (a recipe which did not work).
Around 1669 he heated residues from boiled-down urine on his furnace until the retort was red hot, where all of a sudden glowing fumes filled it and liquid dripped out, bursting into flames. He could catch the liquid in a jar and cover it, where it solidified and continued to give off a pale-green glow. What he collected was phosphorus, which he named from the Greek word for "light-bearing" or "light-bearer."
Phosphorus must have been awe-inspiring to an alchemist: it was a product of man, and seeming to glow with a "life force" that did not diminish over time (and did not need re-exposure to light like the previously discovered Bologna Stone). Brand kept his discovery secret, as alchemists of the time did, and worked with the phosphorus trying unsuccessfully to use it to produce gold.
His recipe was:
* Let urine stand for days until it gives off a pungent smell. (This step was not necessary, as later scientists discovered that fresh urine yielded the same amount of phosphorus).
*Boil urine to reduce it to a thick syrup.
* Heat until a red oil distills up from it, and draw that off.
* Allow the remainder to cool, where it consists of a black spongy upper part and a salty lower part.
* Discard the salt, mix the red oil back into the black material.
* Heat that mixture strongly for 16 hours.
* First white fumes come off, then an oil, then phosphorus.
* The phosphorus may be passed into cold water to solidify.
The chemical reaction Brand stumbled on was as follows. Urine contains phosphates PO, as sodium phosphate (i.e. with Na) in the form of microcosmic salt, and various carbon-based organics. Under strong heat the oxygen atoms from the phosphate react with carbon to produce carbon monoxide CO, leaving elemental phosphorus P, which comes off as a gas. Phosphorus condenses to a liquid below about 280°C and then solidifies (to the white phosphorus allotrope) below about 44°C (depending on purity). This same essential reaction is still used today (but with mined phosphate ores, coke for carbon, and electric furnaces).
Brand's process yielded far less phosphorus than it could have. The salt part he discarded contained most of the phosphate. He used about  of urine to produce just 120 grams of phosphorus. If he had ground up the entire residue he could have obtained many times more than this (1 litre of adult human urine contains about 1.4g of phosphorus salts, which amounts to around 0.11 grams of pure white phosphorus).
Though Brand initially kept his process for producing phosphorus from urine a secret, he later sold the recipe for 200 thalers to a Johann Daniel Kraft  from Dresden. Subsequently, both Swedish chemist Johann Kunckel (in 1678) and English chemist Robert Boyle (in 1680) were able to independently discover phosphorus; the latter's assistant, Ambrose Godfrey-Hanckwitz, later made a business of manufacturing phosphorus from 1707 onwards.