The expect script sends the commands to the session you open. It "expects" the prompt and sends the command when it sees it.
If you can do it manually via telnet then you'll be able to do it in expect.
An example script I use here:
log_file -a expect.out
set ip [lrange $argv 0 0]
spawn telnet $ip
expect "Configuration Login:"
expect "4) Reboot"
expect "Command >"
expect "Reboot! Are you sure (y/n)?"
On invocation I pass the IP of the device I'm telneting into. The script then does the telnet to that IP and waits for a prompt "Configuration Login:" When it gets it then it sends the user name "billybob". It then waits for the "Password:" prompt and sends the password "bobspasswd". It then waits to see menu option "4) Reboot" then waits for the prompt "Command >" after that and sends menu option "4". It then waits for the prompt for reboot and answers with "y". The sleep at the end is to keep it from exiting too soon. It drops the telent connection once it finishes.
Of course I've changed user name and password in the above to protect the guilty.