To create useful a finite element model, the elements have to satisfy several conditions, for example:
If you refine the mesh, in the limit the stress and strain within one element will be approximately constant. Therefore the shape functions must be able to represent constant stress and strain. As a special case, they must be able to represent zero strain - i.e. arbitrary rigid body motion, including rigid body rotation of the element in 2D or 3D models.
The shape functions must be geometrically compatible across the element edges or faces, otherwise the model will contain cracks or holes when the structure deforms.
A finite element model should give the same results if the complete mesh, loads, and boundary conditions are translated and rotated as a rigid body. For example the beam element should "work" in any arbitrary orientation in space, not just along the X axis of the coordinate system.
Another very desirable property is that solutions automatically satisfy the so-called "patch test". Suppose you model a simple region (e.g. a rectangular area or volume) and apply boundary conditions where the correct solution is constant stress or strain inside the volume. The FE model should represent this exactly for any arbitrary distorted mesh that fills the complete area - not just for a "regular" mesh consisting of rectangles or rectangular bricks.
These requirements mean that the shape functions must contain constant and linear polynomial terms, and the easiest way to formulate an element is to make all the terms in the shape functions polynomials (possibly including quadratic and cubic terms as well as linear ones.
There are some types of elements which do include other "special" types of stress and strain. For example, there are elements which can model the infinite stress field at the end of a crack in the material more efficiently than by using a mesh with very small elements around the end of the crack.
Incidentally, making FE models that check out these conditions numerically is a good way to test the code of a new element that you have written.