Start by checking the basics, plugs, wires, cap & rotor (if so equipped), don't forget the coil. After that try tapping different sensors gently to see if a loose connection is happening inside one of them. Wiggle some wires to see if anything changes might work also. If nothing works take it in and have a diagnostic done, at that point you can either fix it yourself or have it done for you. If the check engine light is on you may be able pull the codes or have it scanned to give you some direction.