Probing ultrafast electron dynamics in atoms and molecules