1) Faulty ignition switch. The ignition switch is responsible for providing power to all of the electrical components in your truck. If it fails, none of them will work.
2) Blown fuse. There are a number of fuses in your truck's electrical system that can blow, and if one of them blows, it can cut power to all or part of the system.
3) Loose or corroded battery cable. The battery cables connect the battery to the rest of the electrical system, and if they are loose or corroded, they can cause the system to lose power.
4) Alternator failure. The alternator is responsible for charging the battery, and if it fails, the battery will eventually run out of power and the truck will lose all electrical power.
To troubleshoot the problem, you will need to check each of these potential causes one by one. If you are not comfortable doing this yourself, you can take your truck to a mechanic.