A trill consists of a series of hammer-ons and pull-offs between two notes. A trill is a form of legato that is played both fast and smooth. To perform a trill you must first learn to hammer-on and pull-off. Once you've mastered these techniques all you need to do is put them together. Only one pluck is made at the start of the trill, followed by fast slurring between the two specified notes. Either of the two notes can be the starting note.
Performing a smooth, fast trill takes accuracy, strength and endurance. Practice slowly for short periods of time, then build up speed and trill for longer to improve your endurance.