The word "sentience" has changed in meaning back and forth across the centuries. In the 21st century, for example, it meant the ability to feel or perceive, which may or may not have included being intelligent or self-aware. A separate concept in use at the time was the term "sapient", which meant the ability to act with intelligence. So, for example, a plant could be "sentient", and a computer "sapient" with neither having to have the attributes of the other. Intelligent life was therefore called sapient.
That changed sometime prior to the 22nd century. At that point intelligent life was referred to as sentient. The concepts of perception and intelligence had been combined such that the word now meant an intelligent, self-aware, conscious entity deserving of rights, respect, and freedom. (ENT: "The Seventh", "Rogue Planet", "Hatchery", "Similitude"; TNG: "The Offspring")
In the 23rd century the word "sentient" again meant what it had in centuries past: the ability to feel or perceive. Intelligent life was therefore called generally called sapient rather than sentient. (TOS: "Spock's Brain", "Let That Be Your Last Battlefield", "All Our Yesterdays")
The tide turned again in the 24th century and intelligent life was referred to as it was in the 22nd: as sentient. There was, however, no commonly understood definition of the term. Despite centuries of consideration and linguistic changes, how one determined whether a lifeform or machine was sentient, and the legal and moral implications of being sentient were neither fully understood nor agreed upon. (TNG: "The Measure Of A Man", "The Perfect Mate"; DS9: "The Abandoned")
In the 24th century, an important component of sentience in biological lifeforms was considered to be intelligence. For instance, a large brain implied sentience. (VOY: "Parturition") Another indication of sentience was a lifeform capable of sophisticated communication. (TNG: "The Last Outpost", "Lonely Among Us", "The Loss"; DS9: "The Forsaken") Hard and fast definitions of sentience across biological lifeforms were not yet developed, though. For example, scientist Bruce Maddox could not explain why a Human was sentient; he just knew that he was. (TNG: "The Measure Of A Man") Despite this, some lines of demarcation were acknowledged. A house cat, for example, was not considered to be sentient. (TNG: "Schisms")
In 2365, Phillipa Louvois of the Judge Advocate General's office held a hearing in which she decided that Data was not the property of Starfleet. During the hearing the question of an android's sentience came up, but there was no formal, legal resolution on the matter. (TNG: "The Measure Of A Man") Despite a lack of official acknowledgment, Data thought himself to be sentient, and many others agreed. (TNG: "The Offspring", "The Most Toys", et. al.) So much so that as of 2371, Data was considered the only sentient artificial lifeform in Federation society. (VOY: "Prototype")
From time to time other non-android lifeforms or artificial intelligences have been considered sentient as well. In 2375 the USS Voyager crew determined that a weapon was so sophisticated that it was actually sentient. (VOY: "Warhead") An Automated Personnel Unit designated 3947 was also considered to be sentient when reactivated by B'Elanna Torres in 2372. (VOY: "Prototype")
Holograms have also been referred to as both artificial lifeforms and "sentient". One such sentient hologram was created on the USS Enterprise-D in 2365, when Lieutenant commander Geordi La Forge requested that the holodeck create an opponent worthy of Data in a Sherlock Holmes-style mystery. The ship's computer produced a sentient version of James Moriarty, Holmes' arch-nemesis. (TNG: "Elementary, Dear Data", "Ship in a Bottle") The Federation later encountered a group of Yaderan refugees in 2370 only to discover the entire colony but one man was made up of sentient holograms. (DS9: "Shadowplay")
An early legal case in the arena of holograms and sentience came about in 2378. The Doctor attempted to publish a holonovel entitled Photons Be Free, but it was appropriated and released without his permission by Broht & Forrester. The legal issue revolved around whether The Doctor was an "artist" within the meaning of the laws that granted rights to control the dissemination of intellectual property. The ruling was narrow in that the definition of artist in that single law was extended to a hologram, but it was an important step on the path toward granting full legal status to a hologram as a sentient entity. (VOY: "Author, Author")
Societies other than the Federation have also wrestled with these concepts. In 3074, for example, the Kyrian fully recognized artificial lifeforms – including holograms – as sentient. (VOY: "Living Witness")
Aspects of consciousness
The English word "sapient" means "having intelligence". In that respect TOS was much more correct in its use of language than any subsequent series. The words sentient and sapient are commonly misunderstood and misused by people, though, and the (incorrect) meaning of sentient as used in TNG and beyond has been firmly cemented in Trek to mean a combination of sentience and sapience.