A hologram was a construction of photons, force fields, and holomatter created inside a holodeck, a holosuite, or by another type of holographic projector. Holograms could be manipulated by advanced computer programs, allowing people to interact with the inanimate objects. Holograms can also be projected into space. Some highly advanced holoprograms, such as Emergency Medical Holograms, were even considered sentient beings in their own right; an example of this is USS Voyager's Doctor (an EMH Mark I), who developed a personality distinct from his original programming. (VOY: "Basics, Part I")
In the 23rd century the Federation had holographic imagers, but their resolution was less accurate than the technology that would be developed in the 24th century. (VOY: "Flashback") Holographic recorders that captured motion were common by 2348. For example, Jack Crusher recorded a message for his son. (TNG: "Family") In the alternate reality, Jaylah managed to develop holograms as advanced as those seen a century later. She used them for various means during her life in Altamid, including projectors that hid her makeshift house, the USS Franklin, and a special holodisk that generated various simultaneous images of herself to confuse enemies. (Star Trek Beyond)
By the 24th century, holodecks and thus holograms were a standard part of any Federation life, but generally the holograms were not aware of their own nature, i.e. they were not actually self-aware nor sentient.
The first hologram who attained true sentience was a simulation of James Moriarty. Upon being made sentient, he demanded that Jean-Luc Picard enable him to leave the confines of the holodeck, despite it not being technologically possible at the time. However, after seizing control of the USS Enterprise-D, he was placed in a virtual reality where he could live out his existence. (TNG: "Ship in a Bottle")
On stardate 48315, Dr. Lewis Zimmerman created a highly advanced hologram known as the Emergency Medical Hologram, or EMH. These holograms were meant to be used for a short period of time if medical staff needed help or one was absent. There soon became four versions of this program. The Mark 1s soon became obsolete and were sent to dilithium mines. EMHs, due to the advanced nature of their programs, have been known to develop distinct personalities, and therefore sentience, when operated for a long period of time.
The first hologram who was able to truly exercise its sentience was the EMH of the USS Voyager. His development was slow but he was gradually accepted as part of the crew as well as a friend. Initially, The Doctor was unable to turn his program on and off at will, but was eventually granted this ability. He was even enabled more freedom through use of his mobile emitter, a piece of 29th century technology, which could store and project a hologram in areas that did not have holoemitters installed. (VOY: "Future's End, Part II"). In 2377, he made his first holonovel, called Photons Be Free, where he depicted the mistreatment of an EMH by a darker Voyager. The Doctor eventually realized, after several arguments with the Voyager crew, that the many similarities between the real Voyager and his fictional recreation would taint the reputation of his crew mates. He attempted to make revisions to his novel before it was published, hoping to remove the more blatant similarities. However, his publisher had already released the novel and refused to remove it from publication, stating that as holograms weren't believed to be sentient, they had no legal rights. He fought for the creative control of his novel, backed by the Voyager crew. The courts ruled that, while they couldn't yet judge if The Doctor should be defined as a sentient lifeform, they were willing to extend the definition of an artist to include holograms such as The Doctor. This struck the first blow in attaining more rights for sentient holograms, but the damage had been done in The Doctor's eyes. The novel had been transmitted and it had been widely disseminated without the revisions, tainting Voyager's reputation. However the crew forgave him for this. Photons Be Free later became an inspirational work amongst the obsolete EMHs doomed to work in mines, its message potentially spearheading a new revolution for the EMHs. (VOY: "Author, Author")
In 2370, Jadzia Dax and Odo discovered an entirely holographic village on a planet in the Gamma Quadrant. It was created by the village's sole flesh-and-bone lifeform, Rurigan. Rurigan had created the settlement after his own home and loved ones were destroyed by the Dominion on Yadera Prime. The holograms were housed in a hologenerator. (DS9: "Shadowplay")
In mid 2373, Starfleet investigated the possibility of a Long-term Medical Holographic program (LMH) and considered Deep Space 9's own Julian Bashir as a template. However, when it was discovered that the doctor had undergone illegal genetic enhancement at a young age, he was deemed unsuitable for it. (DS9: "Doctor Bashir, I Presume")
A Delta Quadrant species, known as the Lokirrim, had enslaved holograms, known as "photonics" to them. They rebelled, leading to a war between the two sides. Lokirrim decompile "photonics" wherever they are encountered, even on outsider ships. (VOY: "Body and Soul")
Additionally, the Hirogen used some of Voyager's holographic technology to create new hunting grounds and prey. The Hirogen, however, made the holograms sentient, and quite intelligent, so as to make their prey more challenging. However, these holograms eventually became too smart for the Hirogen, killing many of them and leaving the original confines of the holoships on which they were hunted. During this time, The Doctor experienced emotional turmoil, both due to the nature of the creation of the holograms, and due to the violent nature of their programs. (VOY: "Flesh and Blood")
The Doctor, who had achieved stardom status among the Qomar for his singing in 2376 had singing miniature holograms of himself made, and he even performed a duet with one of them on at least one occasion. (VOY: "Virtuoso")