The Sengoku era marks a century of warfare in Japan, during the latter half of which the powerful daimyo Oda Nobunaga, Toyotomi Hideyoshi, and Tokugawa Ieyasu struggled for dominance, sometimes allied together, sometimes dramatically opposed, until at last Tokugawa Ieyasu was named Shogun in 1603, following his decisive victory at the Battle of Sekigahara, and Japan was united once again.
During this time, documented ninja activity was at its peak. Raids, attempted assassinations, reconnaisance missions, and other military operations were recorded in semi-historical documents such as the Hodo Godai-ki, a chronicle of the Hojo clan who once ruled Japan as regents to the shogun, the Shinchoko-ki, a biography of Oda Nobunaga, and the Iran-ki, the chronicle of Iga province. These references, when taken as a whole, reveal exactly what role the ninja played in warfare of the time.
Siege Warfare: This is by far the most often referenced skill of the ninja. The ability to enter into a castle by means of stealth, and launch a suprise attack on the inhabitants, causing confusion within while the main army storms the castle from without. Typically the ninja party would scale the walls of a castle under the cover of night, then start lighting everything in sight on fire. They would not wear black, but rather, wear the costume of the castle defenders, making it difficult to tell friend from foe, and so make it seem like there is a rebellion within the ranks. Once chaos reigns inside the castle, the army lays siege on its walls from without. If there was any special skill, then, that these ninjas were famous for, this was it. These ninjas were also able to perform valuable services if they were part of the force under siege in a castle. The ninja could sneak out of the castle at night, and steal the banner of the opposing army, and hang it on the battlements in the morning to demoralize the attackers. One source tells of the ninja going out nearly every night from a castle to frighten and harass the attacking army, without doing any physical damage -- however, the troops had to always be on the alert, and being unable to ever get a good night's sleep, the soldiers constantly on edge waiting for an attack all night, they were ineffective when the time came to launch an assault on the castle.
Scouts: Ninjas were often employed to assay the relative strength of the enemy. By one account, a ninja would lay in the tall grass just outside an enemy encampment and remain there until dawn before returning to report. In most cases, however, the scout simply goes on horseback, and is indistinguishable from scouts used in warfare anywhere in the world.
Assassins: This is what the Ninja is known for now. Even in the seventeenth century, the Daimyo feared assassination attempts by ninjas. All of the major generals seemed to have an assassin make an attempt on their life at some point or another. Of course, not all of these attempts are by ninjas, and the most well-known assassination, of Oda Nobunaga, was carried out by one of his generals, and not a ninja at all. In fact, nowhere have a found a single documented successful assassination carried out by a ninja. They were feared throughout Japan for the possibility, but it seems that possibility never became reality. Perhaps it's just like murder today -- everyone fears being killed by some stranger who randomly targets them, but in fact most people are killed by someone they know. The ninja really did try to kill people, though, they just weren't very successful at it. One tactic was to lie down on a battlefield, and when your mark rides through, looking at all the dead bodies, the ninja suddenly springs up and attacks. Nobunaga had some close calls before he met his fate, once being shot twice in the chest, the bullets being stopped by his armor. Later, perhaps learning from the previous attempt, Nobunaga is suprised by three cannon weilding ninjas who try to take him out with a bang. They miss, but kill seven of his retainers. Most ninja assassins were hired by rival daimyo to kill their opponent, without much success. It is this element of ninja skill which has been most over emphasized in our modern understanding of ninja warriors.
In many, but not all, of these accounts the ninjas in question originated from Iga or Koga province, now modern day Mie Province. This is considered the ancestral homeland of the ninja arts, and it does indeed seem to be the main area of ninja activity. Oda Nobunaga finally decided they were too dangerous and crushed Iga in a punitive expedition in 1581. Legend has it that surviving ninja dispersed to all parts of Japan after their defeat. Wherever they went, their usefulness was soon at an end.
But where Oda Nobunaga looked at the ninja and only saw a threat, Tokugawa Ieyasu saw an opportunity, and soon he had a group of Koga ninja in his employ. They participated in the battle of Sekigahara, though without particularly distinguishing themselves. They worked for Tokugawa again in 1614-15, during the campaigns against the last Toyotomi heir, and one last time in 1638 against the Christian daimyo of Kyushu in the Shimabara Rebellion, in both cases operating in their traditional role as masters of seige warfare.