Trees come in two distinct groups within the plant kingdom. The first is the monocotyledon where new growth is produced in radial lines around a central stem, like grasses, lilies, yuccas and phormiums.
The second group is dicotyledons where each year, new growth is accomplished by the division of a specialised tissue called cambium which exists in rings around the circumference of the tree.
In dicotyledons, the cambium tissue divides each year to produce phloem on the outside, which is the tissue responsible for the transportation of sugars manufactured in the leaves to all other parts of the plant, and xylem on the inside. Xylem is dead tissue formed into vessels which carries water and dissolved minerals from the root hairs to all parts of the plant. Because the cambium divides each year, the tree forms distinctive rings. Counting the number of rings in a cross section of trunk lets you see how many growing seasons or years the tree has lived through, because each year a new ring is formed.
Not only that, but botanists can study the width and colour of the rings to see whether a particular year was a good year with plenty of rain and nutrients, which is shown by a wide ring or a poor year with drought, which is shown by a less defined, narrower ring.
In monocotyledon trees like palms, it is harder to see the age because there is no cambium; and xylem and phloem vessels are scattered across the stem. However, a rough estimate can be gauged by counting the number of rings of leaf whorls around the outside of the tree because a new one is formed with each growing season. When these fall, they leave leaf scars, which can be counted. A tall palm tree will have distinctive scars of whorls of leaves formed in previous growing seasons. It is not as accurate as rings in dicotyledonous trees; and these trees tend to grow where there are no defined seasons (equatorial or tropical regions for example).
Some people, if they really know trees, can give a good estimate of its age by the height because they know how much a particular species grows each year on average. They can look at a tree and guage its height and approximate age. While not accurate like rings, this is a good rule of thumb but you need to know your trees as, for example, an oak tree will grow far more slowly than say a poplar.
Determining tree ages can be very useful becasue within a tree's trunk is a history of perhaps several hundreds of years' growing seasons and botanists can learn a great deal about how climate affects the growth; and can also look back through time by looking at the rings and their relative sizes