The Sun is our own special star yet, as stars go, it is a very average star. There are stars far brighter, fainter, hotter and cooler than the Sun. Basically, however, all the stars we can see in the sky are objects similar to the Sun. The force of gravity is continually trying to force the Sun towards its centre, and if there were not some other force counteracting it the Sun would collapse. The necessary outward pressure is produced by the radiation from the nuclear energy generation in the Sun's interior.
Stars form from concentrations in huge interstellar gas clouds.
These contract due to their own gravitational pull. As the cloud gets smaller it loses some of the energy stored in it as potential gravitational energy. This is turned into heat, which in the early days of the embryo star can easily escape, and so the gas cloud stays cool. As the cloud's density rises, it gets more and more difficult for the heat to get out, and so the centre gets hot. If the cloud is big enough, the temperature rise is sufficient for nuclear reactions to take place.